Crate measurements
source · [−]Expand description
Measurements
Measurements is a crate that lets you represent physical quantities, such as Lengths, Masses, Pressures, etc. Each quantity has a series of functions that allow you to convert to and from common units. You can also perform arithmetic on the quantities - for example you can divide a Force by an Area to get a Pressure.
Re-exports
pub use length::Distance;
pub use length::Length;
pub use temperature::Temperature;
pub use temperature::TemperatureDelta;
pub use humidity::Humidity;
pub use mass::Mass;
pub use volume::Volume;
pub use density::Density;
pub use pressure::Pressure;
pub use speed::Speed;
pub use acceleration::Acceleration;
pub use energy::Energy;
pub use power::Power;
pub use voltage::Voltage;
pub use current::Current;
pub use resistance::Resistance;
pub use force::Force;
pub use area::Area;
pub use angle::Angle;
pub use frequency::Frequency;
pub use angular_velocity::AngularVelocity;
pub use torque::Torque;
pub use data::Data;
Modules
Types and constants for handling acceleration.
Types and constants for handling angles
Types and constants for handling speed of rotation (angular velocity)
Types and constants for handling areas.
Types and constants for handling electrical current.
Types and constants for handling amounts of data (in octets, or bits).
Types and constants for handling density.
Types and constants for handling energy.
Types and constants for handling force.
Types and constants for handling frequencies.
Types and constants for handling humidity.
Types and constants for handling lengths (or distances).
Types and constants for handling masses.
Types and constants for handling power.
Traits that it is useful to have in scope. You should wildcard import this file.
Types and constants for handling pressure.
Types and constants for handling electrical resistance.
Types and constants for handling speed.
Types and constants for handling temperature.
Utility code for writing tests.
Types and constants for handling torque
Types and constants for handling voltage.
Types and constants for handling volumes (that is, three-dimensional space, not loudness).
Macros
This is a special macro that creates the code to implement
std::fmt::Display
.
This is a special macro that creates the code to implement operator and comparison overrides.
Structs
If you multiply a Force by a Length, we can’t tell if you’re pushing something along (which requires Energy) or rotating something (which creates a Torque). This struct is what results from the multiplication, and you have to then convert it to whichever you want.
Traits
All measurements implement this.