Repository navigation
v0.16.0
This release contains significant changes in order to support underlying storage types that implement the Num trait beyond f32 and f64. Many changes are breaking: marker traits are simplified and fewer macros are exported. New storage types are not enabled by default and can be used by including the corresponding feature. See the changes below for full details.
Added
- Add missing
#[derive(Hash)]attributes. - #29 A new macro,
storage_types!, is now available to duplicate code on a per-storage type basis. See macro documentation for full details. The minimum supportedrustcversion is now 1.20.0.
Changed
- #29 Underlying storage type now uses the
Numtrait from thenumcrate instead of fixed implementations forf32andf64. Features for all types implementingNumhave been added and control the availability of the type as an underlying storage type:usize,u8,u16,u32,u64,isize,i8,i16,i32,i64,bigint,biguint,rational,rational32,rational64,bigrational,f32, andf64. For compile time reasons onlyf32andf64are enabled by default. Tests are implemented for all underlying storage types but don't account for minimum or maximum values and will fail for non-float types where the conversion factor overflows the type's limits. A future release will correct this. - #29 [Breaking] Traits and structs generated by the
system!macro have been significantly changed in order to support non-float underlying storage types.Dimensionchanged to directly include associated types for quantity dimensions.Units<V>is now only parameterized onVand contains associated types for base units.Conversion<V>has been removed and replaced withuom::Conversion<V>.$quantities<...>has been removed. Quantity dimensions are now directly in theDimensiontrait.BaseUnits<...>has been removed. Base units are not directly in theUnits<V>trait.uom::Conversion<V>added to replaceConversion<V>and gives access to a unit's conversion factor.uom::ConversionFactor<V>added to represent conversion factors for underlying storage types where the type can't be used (e.g.i32's conversion factor is represented asRational32.)
- [Breaking] Macro usage and definitions have been simplified and consolidated.
quantities!,replace_ty!, andunit!have been consolidated as "private" match arms of their calling macro. In order to reduce the chance of macro name collisions$quantities!is the only remaining generated exported macro (e.g.ISQ!for thesisystem). Generated macros for each quantity no longer exist. These changes make it easier to have multiple systems containing quantities with the same names. In order to support this change quantities in theunitsblock of thesystem!macro must always be prefixed by the quantity's module (e.g.length::Length). Prefixing the module with themodkeyword instructs thesystem!macro not to generate a#[macro_use] pub mod $module;statement.