pub struct Unit { /* private fields */ }Implementations§
Source§impl Unit
impl Unit
pub fn new( symbol: impl Into<String>, name: impl Into<String>, dimension: Dimension, base_factor: Decimal, base_unit: impl Into<String>, ) -> Self
pub fn new_base( symbol: impl Into<String>, name: impl Into<String>, dimension: Dimension, ) -> Result<Self, UnitError>
pub fn with_base(self, base_unit: impl Into<String>) -> Self
pub fn symbol(&self) -> &str
pub fn name(&self) -> &str
pub fn dimension(&self) -> &Dimension
pub fn base_factor(&self) -> Decimal
pub fn base_unit(&self) -> &str
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Unit
impl<'de> Deserialize<'de> for Unit
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Unit
Source§impl UnitConversion for Unit
impl UnitConversion for Unit
fn convert_to_base(&self, value: Decimal) -> Decimal
fn convert_from_base(&self, value: Decimal) -> Decimal
Auto Trait Implementations§
impl Forget for Unit
impl Freeze for Unit
impl Move for Unit
impl RefUnwindSafe for Unit
impl Send for Unitwhere
RawVecInner: Send,
impl Sync for Unitwhere
RawVecInner: Sync,
impl Unpin for Unit
impl UnsafeUnpin for Unit
impl UnwindSafe for Unitwhere
RawVecInner: UnwindSafe,
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