Type Alias cooklang::quantity::ScaledQuantity

source ·
pub type ScaledQuantity = Quantity<Value>;

Aliased Type§

struct ScaledQuantity {
    pub value: Value,
    /* private fields */
}

Fields§

§value: Value

Value

Implementations§

source§

impl ScaledQuantity

source

pub fn convert<'a>( &mut self, to: impl Into<ConvertTo<'a>>, converter: &Converter ) -> Result<(), ConvertError>

source

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.

source

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.

source§

impl ScaledQuantity

source

pub fn try_add( &self, rhs: &Self, converter: &Converter ) -> Result<Self, QuantityAddError>

Try adding two quantities