Struct ::exo::Currency

Overview

Currency type for exact financial amounts with exchange rate support.

Methods

fn new(amount: i64, currency: String) -> Result

Creates a new Currency from amount and currency code.

fn new_from_decimal(decimal_str: String, currency: String) -> Result

Creates a new Currency from decimal string and currency code.

Returns the amount in minor units.

Returns the amount as a decimal string.

Returns the amount as a formatted string with apostrophes.

Returns the currency code as string.

Converts to default currency.

fn amount_in_default(self, default: String) -> Result

Returns amount in default currency as string.

Returns the currency as string.

Protocols

protocol partial_eq
if value == b { }

Allows for partial equality operations to work.

protocol string_debug
println("{:?}", value)

Allows the value to be debug printed.

protocol string_display
println("{}", value)

Allows the value to be display printed.