Releases: iliekturtles/uom
v0.21.0
This release adds display tools for quantities resolving another long-standing issue, #13.
Added
- #13 Add display tools for quantities. Allows
Quantity
to be formatted with the standard library formatting traits:Binary
,Debug
,Display
,LowerExp
,LowerHex
,Octal
,UpperExp
,UpperHex
.
Changed
- Improve continuous integration setup.
- Update
clippy
andrustfmt
jobs to use the now stable non-preview
components. - Run OSX and Windows builds on TravisCI.
- Improve individual job build time by reducing unnecessary cached data.
- Update
v0.20.1
This release resolves nightly rustc error E0659 in the base.rs example caused by rust-lang/rust pull request #52841 "resolve: Implement prelude search for macro paths, implement tool attributes."
v0.20.0
This release resolves long-standing issue #3 to implement thermodynamic temperature conversions (e.g. Celsius to Fahrenheit). Support is also added for multiple quantities of the same dimension (e.g. thermodynamic temperature and temperature interval, ratio and angle).
The release also contains a number of internal changes including a reorganization of tests into multiple files and updated CI setup to provide faster builds and more feature test coverage.
Added
- #3 Implement thermodynamic temperature conversions (e.g. Celsius to Fahrenheit). Extend the
quantity!
macro to accept a coefficient and optional constant factor in the$conversion
parameter to support these conversions. - #14 Implement
FromStr
. - #78 Add a
Kind
associated type toDimensions
.The newKind
associated type, defaulting touom::Kind
, allows for multiple quantities that have the same dimensions. Quantities of different kinds are not comparable. The marker traits implemented by a quantity'sKind
control which operations are automatically implemented. - #95
TemperatureInterval
quantity added. IncludesAdd
,AddAssign
,Sub
, andSubAssign
implementations between thermodynamic temperature and temperature interval.
Changed
- [Breaking] Remove unused
_unit: N
parameters and require turbofish syntax forget
,floor
,ceil
,round
,trunc
, andfract
methods ofQuantity
. This is a breaking change and can easily be resolved. e.g.l.get(meter)
becomesl.get::<meter>()
. - #98, #100 Correct
uom
feature hygiene in macro generated code. Previously thesystem!
macro generated code that included#[cfg(feature = "...")]
attributes on code in the crate executing thesystem!
macro. With this fix these attributes will be eagerly evaluated and only generate code when the appropriateuom
feature is enabled. - Spelling corrections for a number of documentation comments and unit abbreviations.
v0.19.0
This release adds a number of additional quantities, configures uom
to use rustfmt
, and directly references num
sub-crates to better control feature selection.
Added
Capacitance
quantity added.ElectricalCharge
quantity added.ElectricalConductance
quantity added.ElectricalResistance
quantity added.Inductance
quantity added.Luminance
quantity added.MagneticFluxDensity
quantity added.MagneticFlux
quantity added.
Changed
- #57
num
sub-cratesnum-traits
,num-rational
, andnum-bigint
are now directly referenced to control feature selection.std
,rational
, andbigint
support are only included based onuom
feature selection. - #80 Setup
rustfmt
so thatuom
code can be automatically formatted and builds are gated on changes not breaking formatting conventions.
v0.18.0
This release contains a significant number of new quantities and units, compile time improvements, and a few bug fixes. See below for full details. Many thanks to Aehmlo for all of the new quantities and units. radix for the autoconvert
feature. Nemo157 for hygiene fixes in the storage_types!
macro.
Added
- #54 [Breaking] Add an
autoconvert
feature, enabled by default, which allows for operations between quantities with different base units.autoconvert
enabled is the same functionality as prior versions ofuom
. Disabling the feature only allows for quantities with the same base units to directly interact. The feature has been added to account for current compiler limitations where zero-cost code is not generated for non-floating point underlying storage types. With the feature disabled more optimal code will be generated for integral types. This feature will likely have no effect and subsequently be deprecated and removed onceconst fn
and specialization are stabilized. - #61 [Breaking] The
storage_types!
macro now always uses underlying storage type features from theuom
crate instead of the crate where the macro is executed. - #2 Additional
Mass
units added. - #5 Additional
Velocity
units added. - #6 Additional
Area
units added. - #7 Additional
Volume
units added. - #8 Additional
Force
units added. - #9 Additional
Acceleration
units added. - #30 Additional
Frequency
units added. - #64
Ratio
(dimensionless) quantity added. IncludesFrom<Ratio> for V
andFrom<V> for Ratio
implementations to allow for easy conversions betweenRatio
and the underlying storage type. - #66
Energy
quantity added. - #67
AvailableEnergy
quantity added. - #68
Density
quantity added. - #69
Power
quantity added. - #70
Pressure
quantity added. - #71
MassRate
quantity added. - #72
VolumeRate
quantity added. - #74
ElectricPotential
quantity added. - #75 Additional
ElectricCurrent
units added.
Changed
- #52 Type aliases generated by the
storage_type!
macro are now public. e.g.pub type V = f32;
. This change drastically reduces compile times, especially when multiple underlying storage types are enabled. - Dimension documentation for
ElectricCurrent
corrected to no longer referencesAmountOfSubstance
and units smaller thanmilliampere
have corrected abbreviations and descriptions.
Removed
- #15 [Breaking] Remove
Product
implementation forQuantity
. The product of a quantity is not that same quantity. e.g.Length * Length = Area
.
v0.17.0
This release implements a number of common traits from the standard library, the num
crate, and the serde
crate.
Added
- #16 Implement
Default
. - #17 Implement
PartialEq
. - #50 Implement
Eq
. - #18 Implement
PartialOrd
. - #51 Implement
Ord
. - #56 Implement
Sum
. - #15 Implement
Product
. - #26 Implement
num::Zero
. - #35 Implement
num::Saturating
. - #37 Implement
serde::Serialize
and
serde::Deserialize
. Disabled by default. Enabled with theuse_serde
feature.
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 supportedrustc
version is now 1.20.0.
Changed
- #29 Underlying storage type now uses the
Num
trait from thenum
crate instead of fixed implementations forf32
andf64
. Features for all types implementingNum
have 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 onlyf32
andf64
are 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.Dimension
changed to directly include associated types for quantity dimensions.Units<V>
is now only parameterized onV
and 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 theDimension
trait.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 thesi
system). 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 theunits
block of thesystem!
macro must always be prefixed by the quantity's module (e.g.length::Length
). Prefixing the module with themod
keyword instructs thesystem!
macro not to generate a#[macro_use] pub mod $module;
statement.
v0.15.0
This release adds additional Time
units; Frequency
, Force
, and Volume
quantities; and numerous floating point methods such as min
, max
, and powi
.
Added
- #4 Additional
Time
units added. - Add missing
giga
units. e.g.gigameter
. - #11 Add floating point classification methods
classify
,is_finite
,is_infinte
,is_nan
, andis_normal
forQuantity
. - #11 Add floating point fractional methods
floor
,ceil
,round
,trunc
, andfract
forQuantity
. - #11 Add floating point comparison methods
max
andmin
forQuantity
. - #11 Add floating point
mul_add
method forQuantity
. - #11 Add floating point
powi
method forQuantity
. - #7
Volume
quantity added. Additional units still need to be added. - #8
Force
quantity added. Additional units still need to be added. - #30
Frequency
quantity added. Additional units still need to be added.
v0.14.0
Added
- [Breaking] A new feature,
std
, is now available and is enabled by default.uom
can still be compiled withno_std
by using--no-default-features
when compiling the crate ordefault-features = false
in thedependencies
section ofCargo.toml
- #11
cbrt
,recip
, andsqrt
are implemented forQuantity
.
Changed
- #28
Quantity
fields made public in order to allow library users to createconst
values and instances of non-named quantities. e.g.const TIME_STEP: Time = Quantity { dimension: PhantomData, units: PhantomData, value: 0.1 };
This functionality will be deprecated and subsequently removed once theconst fn
feature is stabilized. - Tests now run for all enabled underlying storage types (
f32
,f64
).
Fixed
- Fixed incorrect conversion factor when multiplying or dividing
Quantity
s with different base units.
v0.13.0
This release adds numerous tests both for code generated by the quantity!
, system!
, and $quantities!
macros as well as derived quantities. Fixes for issues found during testing noted below. Quantity implementations for Area
and Acceleration
also added.
Added
- #6
Area
quantity added. Additional units still need to be added. - #9
Acceleration
quantity added. Additional units still need to be added.
Changed
- [Breaking] Remove the unused
_unit
parameter fromQuantity::new
and so summon the turbofish. e.g.Length::new(1.0, meter)
becomesLength::new::<meter>(1.0)
. - #22 Change
impl Debug
forQuantity
to use precision information. Previously the implementation checked thealternate
flag which has no affect on printing raw floats. - #27 Change superscripts in documentation to the format supported by
pulldown
in anticipation of upcommingrustdoc
changes.
Fixed
- #22 Fix
impl Sub
forQuantity
to be implemented in terms of-
instead of+
.