pub struct NumberFormat { /* private fields */ }Expand description
Holds the pattern for the number format and some additional data.
Implementations§
Source§impl NumberFormat
impl NumberFormat
Sourcepub fn news<S: AsRef<str>>(
pattern: S,
sym: NumberSymbols,
) -> Result<Self, NumberFmtError>
pub fn news<S: AsRef<str>>( pattern: S, sym: NumberSymbols, ) -> Result<Self, NumberFmtError>
New format from pattern + symbols
Sourcepub fn sym(&self) -> &NumberSymbols
pub fn sym(&self) -> &NumberSymbols
Symbols
Sourcepub fn fmt_u<Number: LowerExp + Display>(&self, number: Number) -> String
pub fn fmt_u<Number: LowerExp + Display>(&self, number: Number) -> String
Formats and unwraps any error. The error is written to the result string using {:?}. So this one may be convenient in some situations, but …
Sourcepub fn fmt<Number: LowerExp + Display>(
&self,
number: Number,
) -> Result<String, NumberFmtError>
pub fn fmt<Number: LowerExp + Display>( &self, number: Number, ) -> Result<String, NumberFmtError>
Formats.
Sourcepub fn fmt_to<Number: LowerExp + Display, W: FmtWrite>(
&self,
number: Number,
out: &mut W,
) -> Result<(), NumberFmtError>
pub fn fmt_to<Number: LowerExp + Display, W: FmtWrite>( &self, number: Number, out: &mut W, ) -> Result<(), NumberFmtError>
Formats to a buffer.
Sourcepub fn parse<F: FromStr>(&self, s: &str) -> Result<F, NumberFmtError>
pub fn parse<F: FromStr>(&self, s: &str) -> Result<F, NumberFmtError>
Parse using the exact format. See ParseNumber::parse_sym()(crate::number::ParseNumber::parse_sym()]
Trait Implementations§
Source§impl Clone for NumberFormat
impl Clone for NumberFormat
Source§fn clone(&self) -> NumberFormat
fn clone(&self) -> NumberFormat
Returns a duplicate of the value. Read more
1.0.0 · 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 NumberFormat
impl Debug for NumberFormat
Source§impl Default for NumberFormat
impl Default for NumberFormat
Source§fn default() -> NumberFormat
fn default() -> NumberFormat
Returns the “default value” for a type. Read more
Source§impl Display for NumberFormat
impl Display for NumberFormat
Source§impl PartialEq for NumberFormat
impl PartialEq for NumberFormat
impl Eq for NumberFormat
impl StructuralPartialEq for NumberFormat
Auto Trait Implementations§
impl Freeze for NumberFormat
impl RefUnwindSafe for NumberFormat
impl Send for NumberFormat
impl Sync for NumberFormat
impl Unpin for NumberFormat
impl UnwindSafe for NumberFormat
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