pub struct Prefix<'a> { /* private fields */ }Expand description
Implements Display with the currency symbol at the front.
Methods from Deref<Target = Currency>§
Sourcepub fn postfix(&self) -> Postfix<'_>
pub fn postfix(&self) -> Postfix<'_>
Returns an object that implements Display for different methods of printing currency.
Examples found in repository?
More examples
Sourcepub fn prefix(&self) -> Prefix<'_>
pub fn prefix(&self) -> Prefix<'_>
Returns an object that implements Display for different methods of printing currency.
Examples found in repository?
More examples
Trait Implementations§
Source§impl<'a> Display for Prefix<'a>
Allows Currencies to be displayed as Strings. The format includes no comma delimiting with a
two digit precision decimal.
impl<'a> Display for Prefix<'a>
Allows Currencies to be displayed as Strings. The format includes no comma delimiting with a two digit precision decimal.
§Examples
use claude::Currency;
assert!(Currency{ symbol: Some('$'), value: 1210}.prefix().to_string() == "$12.10");
assert!(Currency{ symbol: None, value: 1210}.prefix().to_string() == "12.10");
println!("{}", Currency{ symbol: Some('$'), value: 100099}.prefix());The last line prints the following:
"$1000.99"Auto Trait Implementations§
impl<'a> Freeze for Prefix<'a>
impl<'a> RefUnwindSafe for Prefix<'a>
impl<'a> Send for Prefix<'a>
impl<'a> Sync for Prefix<'a>
impl<'a> Unpin for Prefix<'a>
impl<'a> UnwindSafe for Prefix<'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