Skip to main content

Crate gnu_units

Crate gnu_units 

Source
Expand description

Safe, high-level Rust interface to GNU Units.

By default this crate uses a native pure-Rust unit engine. Build with --no-default-features --features vendored to use the vendored C library instead.

Structs§

Definition
A single entry from the GNU units definitions database.
Unit
Represents a dimensional quantity: a numeric factor paired with zero or more base dimensions.
UnitsError
Wraps a raw error code returned by the units engine.

Enums§

DefinitionKind
The kind of a definition entry in the GNU units database.
ErrorCode
Numeric error codes matching the GNU units C library values.

Functions§

conformable
Returns all unit definitions conformable with expr in alphabetical order.
convert
Parses from and to as GNU units expressions and returns the numeric conversion factor.
list_definitions
Returns all unit definitions from the embedded GNU units database, sorted alphabetically.
parse
Convenience wrapper around Unit::parse.

Type Aliases§

Result
Convenience alias for std::result::Result<T, UnitsError>.