You can control the available storage types, the inclusion of the SI system, and other capabilities using Cargo features. By default, f32, f64, std, and si are enabled.
To customize your build, use --no-default-features and specify the required features in Cargo.toml:
[dependencies]
uom = {
version = "0.38.0",
default-features = false,
features = [
"autoconvert",
"f32",
"si",
"std",
"serde",
]
}
Available Features
autoconvert: Enables automatic conversion between base units in binary operators. Disabling this requires quantities to share the same base units for direct interaction.- Storage Types: At least one storage type feature must be enabled. Options include:
- Floating point:
f32, f64 (default) - Unsigned integers:
usize, u8, u16, u32, u64, u128 - Signed integers:
isize, i8, i16, i32, i64, i128 - Arbitrary width:
bigint, biguint - Rational:
rational, rational32, rational64, bigrational - Complex:
complex32, complex64
si: Includes the pre-built International System of Units (enabled by default).std: Enables standard library support (enables no_std if disabled).serde: Enables serialization and deserialization support (disabled by default).
[dependencies]
uom = {
version = "0.38.0",
default-features = false,
features = [
"autoconvert", # automatic base unit conversion.
"usize", "u8", "u16", "u32", "u64", "u128", # Unsigned integer storage types.
"isize", "i8", "i16", "i32", "i64", "i128", # Signed integer storage types.
"bigint", "biguint", # Arbitrary width integer storage types.
"rational", "rational32", "rational64", "bigrational", # Integer ratio storage types.
"complex32", "complex64", # Complex floating point storage types.
"f32", "f64", # Floating point storage types.
"si", "std", # Built-in SI system and std library support.
"serde", # Serde support.
]
}