#[non_exhaustive]pub struct Unit {
pub family: Option<String>,
pub name: Option<String>,
pub plural: Option<String>,
pub scale_factor: Option<f64>,
pub short_name: Option<String>,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}
Expand description
Object containing the metric unit family, scale factor, name, and short name.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.family: Option<String>
Unit family, allows for conversion between units of the same family, for scaling.
name: Option<String>
Unit name
plural: Option<String>
Plural form of the unit name.
scale_factor: Option<f64>
Factor for scaling between units of the same family.
short_name: Option<String>
Abbreviation of the unit.
additional_properties: BTreeMap<String, Value>
Implementations§
Source§impl Unit
impl Unit
pub fn new() -> Unit
pub fn family(self, value: String) -> Self
pub fn name(self, value: String) -> Self
pub fn plural(self, value: String) -> Self
pub fn scale_factor(self, value: f64) -> Self
pub fn short_name(self, value: String) -> Self
pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self
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
Auto Trait Implementations§
impl Freeze for Unit
impl RefUnwindSafe for Unit
impl Send for Unit
impl Sync for Unit
impl Unpin for Unit
impl UnwindSafe for Unit
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