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

Function convert_volume

src/conversions/volume.rs:185–188  ·  view source on GitHub ↗

Convert a volume value from one unit to another # Examples ``` use the_algorithms_rust::conversions::{convert_volume, VolumeUnit}; let liters = convert_volume(1.0, VolumeUnit::CubicMeter, VolumeUnit::Liter); assert_eq!(liters, 1000.0); let gallons = convert_volume(1.0, VolumeUnit::Liter, VolumeUnit::GallonUs); assert!((gallons - 0.264172).abs() < 0.0001); ```

(value: f64, from: VolumeUnit, to: VolumeUnit)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers 1

Calls 2

to_cubic_metersMethod · 0.80
cubic_meters_to_unitMethod · 0.80

Tested by 1