pub struct UnitRegistry { /* private fields */ }Implementations§
Source§impl UnitRegistry
impl UnitRegistry
pub fn new() -> Self
pub fn register(&mut self, unit: Unit) -> Result<(), UnitError>
pub fn register_dimension(&mut self, dimension: Dimension)
pub fn register_base( &mut self, dimension: Dimension, base_unit: impl Into<String>, )
pub fn get_unit(&self, symbol: &str) -> Result<&Unit, UnitError>
pub fn units(&self) -> &HashMap<String, Unit>
pub fn base_units(&self) -> &HashMap<Dimension, String>
pub fn convert( &self, value: Decimal, from: &Unit, to: &Unit, ) -> Result<Decimal, UnitError>
pub fn global() -> &'static RwLock<UnitRegistry>
Trait Implementations§
Source§impl Clone for UnitRegistry
impl Clone for UnitRegistry
Source§fn clone(&self) -> UnitRegistry
fn clone(&self) -> UnitRegistry
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for UnitRegistry
impl Debug for UnitRegistry
Auto Trait Implementations§
impl Freeze for UnitRegistry
impl RefUnwindSafe for UnitRegistry
impl Send for UnitRegistry
impl Sync for UnitRegistry
impl Unpin for UnitRegistry
impl UnwindSafe for UnitRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more