diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2025-02-16 11:52:23 -0500 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2025-02-16 11:52:23 -0500 |
| commit | 4ba873caba1d725aa72a135e4bd5fc69a9b7ef64 (patch) | |
| tree | 57f7c9646b78dfa13ddfc225a5ae5b1f750ff408 /volume.go | |
| parent | 6498718bd0ea27606dc0a4e67d4a966ffe1abfdf (diff) | |
| download | volute-4ba873caba1d725aa72a135e4bd5fc69a9b7ef64.zip | |
microui
Diffstat (limited to 'volume.go')
| -rw-r--r-- | volume.go | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/volume.go b/volume.go deleted file mode 100644 index 6f5fb31..0000000 --- a/volume.go +++ /dev/null @@ -1,33 +0,0 @@ -package main - -import ( - "errors" - "fmt" -) - -type Volume float32 - -const ( - CubicCentimetre Volume = 1 - Litre Volume = 1_000 - CubicMetre Volume = 1_000_000 - CubicInch Volume = 16.38706 -) - -var VolumeUnits = []string{"cc", "L", "m³", "in³"} - -func ParseVolumeUnit(s string) (Volume, error) { - // Each case corresponds to a value in VolumeUnits. - switch s { - case "cc": - return CubicCentimetre, nil - case "L": - return Litre, nil - case "m³": - return CubicMetre, nil - case "in³": - return CubicInch, nil - default: - return *new(Volume), errors.New(fmt.Sprintf("invalid volume unit: '%s'", s)) - } -} |