pub struct NumberStyle<'a> {
pub decimals: usize,
pub group: Option<char>,
pub decimal: char,
pub prefix: &'a str,
pub suffix: &'a str,
}Expand description
How to write a number: decimal places, separators and text around it. This is the one place
that lays out digits, for Culture and for anything with separators of its own.
use ravenrs_criteria::NumberStyle;
let style = NumberStyle { decimals: 2, group: Some('.'), decimal: ',', prefix: "R$ ", suffix: "" };
assert_eq!(style.format(-1234.5), "-R$ 1.234,50");Fields§
§decimals: usizeDigits after the decimal separator.
group: Option<char>Thousands separator, if digits are grouped.
decimal: charDecimal separator.
prefix: &'a strText before the number, after the sign (e.g. a currency symbol).
suffix: &'a strText after the number (e.g. %).
Implementations§
Trait Implementations§
Source§impl<'a> Clone for NumberStyle<'a>
impl<'a> Clone for NumberStyle<'a>
Source§fn clone(&self) -> NumberStyle<'a>
fn clone(&self) -> NumberStyle<'a>
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 moreimpl<'a> Copy for NumberStyle<'a>
Source§impl<'a> Debug for NumberStyle<'a>
impl<'a> Debug for NumberStyle<'a>
impl<'a> Eq for NumberStyle<'a>
Source§impl<'a> PartialEq for NumberStyle<'a>
impl<'a> PartialEq for NumberStyle<'a>
impl<'a> StructuralPartialEq for NumberStyle<'a>
Auto Trait Implementations§
impl<'a> Freeze for NumberStyle<'a>
impl<'a> RefUnwindSafe for NumberStyle<'a>
impl<'a> Send for NumberStyle<'a>
impl<'a> Sync for NumberStyle<'a>
impl<'a> Unpin for NumberStyle<'a>
impl<'a> UnsafeUnpin for NumberStyle<'a>
impl<'a> UnwindSafe for NumberStyle<'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