Struct bill::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<char>
Currency symbol
pick any of €
, £
, $
, ¥
etc…
value: i64
value in the smallest possible unit
Implementations
Initialize from i64
Returns an object that implements Display
for different methods of printing currency.
Returns an object that implements Display
for different methods of printing currency.
Returns the value as float
Warning, do not use this for calculation, this is for displaying only!
Methods from Deref<Target = i64>
Trait Implementations
Overloads the ‘+’ operator for Currency objects.
Panics
Panics if the two addends are different types of currency, as denoted by the Currency’s symbol.
Required for DerefMut
Overloads the ‘/’ operator for Currency objects.
Allows a Currency to be divided by an i64.
Overloads the ‘*’ operator for i64.
Allows an i64 to be multiplied by a Currency. Completes the commutative property for i64 multiplied by Currency.
Multiplies with float, probably not a good idea, help appreciated.
Overloads the ‘*’ operator for Currency objects.
Allows a Currency to be multiplied by an i64.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
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.
Auto Trait Implementations
impl RefUnwindSafe for Currency
impl UnwindSafe for Currency
Blanket Implementations
Mutably borrows from an owned value. Read more