Skip to content

Commit

Permalink
Hacking around privacy of Units no longer needed
Browse files Browse the repository at this point in the history
The problem around which we had to hack, has now been fixed in `uom`, so
remove the hack.

iliekturtles/uom#295 (comment)
  • Loading branch information
jacg committed Aug 19, 2022
1 parent 3e0b1a3 commit 0a19b8a
Showing 1 changed file with 2 additions and 24 deletions.
26 changes: 2 additions & 24 deletions units/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,6 @@ pub type InvertDimension<D> = uom::si::ISQ<
/// metres and seconds as the base units of `Length` and `Time`
/// Useful for bitwise compatibility with data generated by Geant4.
pub mod mmps {

use uom::si::{
length::millimeter,
mass::kilogram,
time::picosecond,
electric_current::ampere,
thermodynamic_temperature::kelvin,
amount_of_substance::mole,
luminous_intensity::candela,
};

// TODO: replace with system! macro, once it has been fixed in uom
pub type Units = dyn uom::si::Units<
f32,
length = millimeter,
mass = kilogram,
time = picosecond,
electric_current = ampere,
thermodynamic_temperature = kelvin,
amount_of_substance = mole,
luminous_intensity = candela>;

pub mod f32 {
use uom::{ISQ, system};
ISQ!(uom::si, f32, (millimeter, kilogram, picosecond, ampere, kelvin, mole, candela));
Expand All @@ -80,8 +58,8 @@ pub mod mmps {
}

use uom::typenum::{P2, N1, Z0};
pub type PerLength = Quantity<InvertDimension<uom::si::length::Dimension>, mmps::Units, f32>;
pub type AreaPerMass = Quantity<uom::si::ISQ<P2, N1, Z0, Z0, Z0, Z0, Z0> , mmps::Units, f32>;
pub type PerLength = Quantity<InvertDimension<uom::si::length::Dimension>, mmps::f32::Units, f32>;
pub type AreaPerMass = Quantity<uom::si::ISQ<P2, N1, Z0, Z0, Z0, Z0, Z0> , mmps::f32::Units, f32>;

//use uom::fmt::DisplayStyle::Abbreviation;
pub use uom::si::Quantity;
Expand Down

0 comments on commit 0a19b8a

Please sign in to comment.