Struct human_number::Options
source · 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§
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)