Struct claude::Currency [−][src]
Expand description
Represents currency through an optional symbol and amount of coin.
Each 100 coins results in a banknote. (100 is formatted as 1.00)
The currency will be formatted as such: Currency(Some('$'), 432)
==> “$4.32”
Fields
symbol: Option<Symbol>
Currency symbol
pick any of €
, £
, $
, ¥
etc…
value: i64
value in the smallest possible unit
Implementations
impl Currency
[src]
impl Currency
[src]pub fn from_value(value: i64) -> Currency
[src]
pub fn from_value(value: i64) -> Currency
[src]Initialize from i64
pub fn postfix(&self) -> Postfix<'_>
[src]
pub fn postfix(&self) -> Postfix<'_>
[src]Returns an object that implements Display
for different methods of printing currency.
pub fn prefix(&self) -> Prefix<'_>
[src]
pub fn prefix(&self) -> Prefix<'_>
[src]Returns an object that implements Display
for different methods of printing currency.
pub fn as_float(&self) -> f64
[src]
pub fn as_float(&self) -> f64
[src]Returns the value as float
Warning, do not use this for calculation, this is for displaying only!
Methods from Deref<Target = i64>
pub const MIN: i64
1.43.0[src]
pub const MAX: i64
1.43.0[src]
pub const BITS: u32
1.53.0[src]
pub fn as_ne_bytes(&self) -> &[u8; 8]
[src]
🔬 This is a nightly-only experimental API. (num_as_ne_bytes
)
pub fn as_ne_bytes(&self) -> &[u8; 8]
[src]num_as_ne_bytes
)Return the memory representation of this integer as a byte array in native byte order.
to_ne_bytes
should be preferred over this whenever possible.
Examples
#![feature(num_as_ne_bytes)] let num = 0x1234567890123456i64; let bytes = num.as_ne_bytes(); assert_eq!( bytes, if cfg!(target_endian = "big") { &[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56] } else { &[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12] } );
Trait Implementations
impl Add<Currency> for Currency
[src]
impl Add<Currency> for Currency
[src]Overloads the ‘+’ operator for Currency objects.
Panics
Panics if the two addends are different types of currency, as denoted by the Currency’s symbol.
impl Div<i64> for Currency
[src]
impl Div<i64> for Currency
[src]Overloads the ‘/’ operator for Currency objects.
Allows a Currency to be divided by an i64.
impl Mul<Currency> for i64
[src]
impl Mul<Currency> for i64
[src]Overloads the ‘*’ operator for i64.
Allows an i64 to be multiplied by a Currency. Completes the commutative property for i64 multiplied by Currency.
impl Mul<i64> for Currency
[src]
impl Mul<i64> for Currency
[src]Overloads the ‘*’ operator for Currency objects.
Allows a Currency to be multiplied by an i64.
impl PartialOrd<Currency> for Currency
[src]
impl PartialOrd<Currency> for Currency
[src]fn partial_cmp(&self, other: &Currency) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Currency) -> Option<Ordering>
[src]This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Sub<Currency> for Currency
[src]
impl Sub<Currency> for Currency
[src]Overloads the ‘-’ operator for Currency objects.
Panics
Panics if the minuend and subtrahend are two different types of currency, as denoted by the Currency’s symbol.
impl Copy for Currency
[src]
impl Eq for Currency
[src]
impl StructuralEq for Currency
[src]
impl StructuralPartialEq for Currency
[src]
Auto Trait Implementations
impl RefUnwindSafe for Currency
impl Send for Currency
impl Sync for Currency
impl Unpin for Currency
impl UnwindSafe for Currency
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more