MCPcopy Create free account
hub / github.com/TheAlgorithms/Rust / convert_weight

Function convert_weight

src/conversions/weight.rs:287–309  ·  view source on GitHub ↗

Convert weight from one unit to another. This function accepts both `WeightUnit` enums and string identifiers. # Arguments `value` - The numerical value to convert `from_unit` - The unit to convert from (can be a `WeightUnit` enum or a string) `to_unit` - The unit to convert to (can be a `WeightUnit` enum or a string) # Returns The converted value, or an error if the unit is invalid # Exampl

(value: f64, from_unit: F, to_unit: T)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers 1

Calls 2

into_weight_unitMethod · 0.80
to_kilogram_factorMethod · 0.80

Tested by 1