From 31605150d3e10b08dad2086005c64664f5648a51 Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Fri, 27 May 2022 22:39:03 -0230 Subject: prepare to switch ui library --- mass/mass.go | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'mass/mass.go') diff --git a/mass/mass.go b/mass/mass.go index 46ce33e..c66e94d 100644 --- a/mass/mass.go +++ b/mass/mass.go @@ -16,30 +16,17 @@ const ( type FlowRate float32 const ( - KilogramsPerSecond FlowRate = 1 - PoundsPerMinute FlowRate = 0.007_559_872_833 -) - -// FlowRateUnitStrings returns a slice of strings, each representing a -// flowRate unit. -// This is necessary because giu.Combo only works with strings. -func FlowRateUnitStrings() []string { - return []string{"kg/s", "lb/min"} -} - -const ( - DefaultFlowRateUnit FlowRate = KilogramsPerSecond - // DefaultFlowRateUnitIndex is used to index FlowRateUnitStrings() - DefaultFlowRateUnitIndex int32 = 0 // kg/s + KilogramPerSecond FlowRate = 1 + PoundPerMinute FlowRate = 0.007_559_872_833 ) func FlowRateUnitFromString(s string) (FlowRate, error) { // Each case corresponds to a value in FlowRateUnitStrings(). switch s { case "kg/s": - return KilogramsPerSecond, nil + return KilogramPerSecond, nil case "lb/min": - return PoundsPerMinute, nil + return PoundPerMinute, nil default: return *new(FlowRate), errors.New( fmt.Sprintf("invalid mass flow rate unit: '%s'", s)) -- cgit v1.2.3