-
Notifications
You must be signed in to change notification settings - Fork 109
Metric Teaspoons, Tablespoons & Cups #525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This change also deprecates the non-suffixed tsp, tbsp and cups units. Currently, they remain with US units, but it is suggested to use the specific suffixed units (e.g. tablespoon_us) going forward
@teaspoon: 4.928_922_E-6; "tsp", "teaspoon", "teaspoons"; | ||
#[deprecated(note = "please use suffixed unit e.g. _us, _aus, _metric")] | ||
#[doc = "US tablespoons. Deprecated."] // doc is required here, see macro arms in unit.rs L368 vs L374 | ||
@tablespoon: 1.478_676_E-5; "tbsp (US)", "tablespoon (US)", "tablespoons (US)"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure what to do with the naming changes — technically this could be considered breaking if a library user is relying on matching the abbreviations or names.
However since this is the SI module I assume that the metric units should take priority.
Hello @OJFord since you contributed to the original issue mind giving this a quick once over? Sorry for the ping! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
src/si/volume.rs
Outdated
#[doc = "US cups. Deprecated."] | ||
#[deprecated(note = "please use suffixed unit e.g. _us, _metric")] | ||
@cup: 2.365_882_E-4; "cup (US)", "cup (US)", "cups (US)"; | ||
@cup_us: 2.365_882_E-4; "cup (US)", "cup (US)", "cups (US)"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is 'US customary' - there is also 'US legal' (240ml precisely) so it's probably worth being clear what it is even if not also providing the other.
(There's also the old UK imperial system based cup size, I believe it's the same number of floz as US customary cup, but since UK floz != US floz it works out to be about 284ml. It's obsolete though, and I think was never really that common (vs. floz & pints even if they work out to round cups or fractions) so maybe not worth adding.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, thanks for the suggestion.
Modified cup_us
to be cup_us_customary
and added a cup_us_legal
at 240mL, and also changed unit names in 6c716a8
Differentiated between US legal cups (240mL) vs. US customary cups (~237mL)
Implements #282
Added metric teaspoons, tablespoons and cups. Followed advice set out in 282 in regards to deprecation of old, non-suffixed units.
Pre-existing cups, tablespoons & teaspoons continue to be US measurements but are marked as deprecated with alternative
cup_us
,tablespoon_us
, etc. provided alongside their metriccup_metric
counterparts.