#[non_exhaustive]pub enum LengthFormat {
Decimal {
unit: ConversionUnit,
decimal_places: u8,
},
FeetInches {
denominator: u32,
suppress_zero_inches: bool,
},
Inches {
denominator: u32,
},
}Expand description
How format_length writes a length.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Decimal
The value in unit, with decimal_places digits after the point:
1.25 for 1250 mm in metres with two places. No unit symbol is
written.
Fields
§
unit: ConversionUnitThe unit to write the value in.
FeetInches
Feet and inches, the inches rounded to the nearest
1/denominator: 5' - 6 1/2". With suppress_zero_inches, a whole
number of feet is written 5'.
Fields
Inches
Inches only, rounded to the nearest 1/denominator: 66 1/2".
Implementations§
Source§impl LengthFormat
impl LengthFormat
Sourcepub fn decimal(unit: ConversionUnit, decimal_places: u8) -> Self
pub fn decimal(unit: ConversionUnit, decimal_places: u8) -> Self
Decimal with decimal_places digits in unit.
Sourcepub fn feet_inches(denominator: u32, suppress_zero_inches: bool) -> Self
pub fn feet_inches(denominator: u32, suppress_zero_inches: bool) -> Self
FeetInches to the nearest 1/denominator inch.
Trait Implementations§
Source§impl Clone for LengthFormat
impl Clone for LengthFormat
Source§fn clone(&self) -> LengthFormat
fn clone(&self) -> LengthFormat
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 LengthFormat
impl Debug for LengthFormat
Source§impl PartialEq for LengthFormat
impl PartialEq for LengthFormat
impl StructuralPartialEq for LengthFormat
Auto Trait Implementations§
impl Freeze for LengthFormat
impl RefUnwindSafe for LengthFormat
impl Send for LengthFormat
impl Sync for LengthFormat
impl Unpin for LengthFormat
impl UnsafeUnpin for LengthFormat
impl UnwindSafe for LengthFormat
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