pub struct Options<'a> { /* private fields */ }Expand description
Set of options used for formating numbers.
Implementations§
Source§impl<'a> Options<'a>
impl<'a> Options<'a>
pub const fn new( decimals: usize, separator: Cow<'a, str>, unit: Option<Cow<'a, str>>, ) -> Self
Sourcepub fn set_force_sign(&mut self, force_sign: bool)
pub fn set_force_sign(&mut self, force_sign: bool)
Forces the sign to be displayed.
Sourcepub const fn with_force_sign(self, force_sign: bool) -> Self
pub const fn with_force_sign(self, force_sign: bool) -> Self
Forces the sign to be displayed.
Sourcepub fn set_decimals(&mut self, decimals: usize)
pub fn set_decimals(&mut self, decimals: usize)
Sets the number of decimals to display.
Sourcepub const fn with_decimals(self, decimals: usize) -> Self
pub const fn with_decimals(self, decimals: usize) -> Self
Sets the number of decimals to display.
Sourcepub fn set_unit<U: Into<Cow<'a, str>>>(&mut self, unit: U)
pub fn set_unit<U: Into<Cow<'a, str>>>(&mut self, unit: U)
Sets the expected unit, like B for bytes or g for grams.
Sourcepub fn with_unit<U: Into<Cow<'a, str>>>(self, unit: U) -> Self
pub fn with_unit<U: Into<Cow<'a, str>>>(self, unit: U) -> Self
Sets the expected unit, like B for bytes or g for grams.
Sourcepub fn set_separator<U: Into<Cow<'a, str>>>(&mut self, separator: U)
pub fn set_separator<U: Into<Cow<'a, str>>>(&mut self, separator: U)
Sets the separator between the number and the preffix.
Sourcepub fn with_separator<U: Into<Cow<'a, str>>>(self, separator: U) -> Self
pub fn with_separator<U: Into<Cow<'a, str>>>(self, separator: U) -> Self
Sets the separator between the number and the preffix.
Trait Implementations§
impl<'a> Eq for Options<'a>
impl<'a> StructuralPartialEq for Options<'a>
Auto Trait Implementations§
impl<'a> Freeze for Options<'a>
impl<'a> RefUnwindSafe for Options<'a>
impl<'a> Send for Options<'a>
impl<'a> Sync for Options<'a>
impl<'a> Unpin for Options<'a>
impl<'a> UnwindSafe for Options<'a>
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