Type Alias cooklang::quantity::ScaledQuantity
source · pub type ScaledQuantity = Quantity<Value>;Aliased Type§
struct ScaledQuantity {
pub value: Value,
/* private fields */
}Fields§
§value: ValueValue
Implementations§
source§impl ScaledQuantity
impl ScaledQuantity
pub fn convert<'a>( &mut self, to: impl Into<ConvertTo<'a>>, converter: &Converter ) -> Result<(), ConvertError>
sourcepub fn fit(&mut self, converter: &Converter) -> Result<(), ConvertError>
pub fn fit(&mut self, converter: &Converter) -> Result<(), ConvertError>
Converts the unit to the best possible match in the same unit system.
For example, 1000 ml would be converted to 1 l.
sourcepub fn try_fraction(&mut self, converter: &Converter) -> bool
pub fn try_fraction(&mut self, converter: &Converter) -> bool
Tries to convert the value to a fraction, keeping the same unit
It respects the converter configuration for the unit.