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§

acceleration
Types and constants for handling acceleration.
angle
Types and constants for handling angles
angular_velocity
Types and constants for handling speed of rotation (angular velocity)
area
Types and constants for handling areas.
current
Types and constants for handling electrical current.
data
Types and constants for handling amounts of data (in octets, or bits).
density
Types and constants for handling density.
energy
Types and constants for handling energy.
force
Types and constants for handling force.
frequency
Types and constants for handling frequencies.
humidity
Types and constants for handling humidity.
length
Types and constants for handling lengths (or distances).
mass
Types and constants for handling masses.
power
Types and constants for handling power.
prelude
Traits that it is useful to have in scope. You should wildcard import this file.
pressure
Types and constants for handling pressure.
resistance
Types and constants for handling electrical resistance.
speed
Types and constants for handling speed.
temperature
Types and constants for handling temperature.
test_utils
Utility code for writing tests.
torque
Types and constants for handling torque
voltage
Types and constants for handling voltage.
volume
Types and constants for handling volumes (that is, three-dimensional space, not loudness).

Macros§

implement_display
This is a special macro that creates the code to implement std::fmt::Display.
implement_measurement
This is a special macro that creates the code to implement operator and comparison overrides.

Structs§

TorqueEnergy
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§

Measurement
All measurements implement this.