pub struct ListExchangeRate { /* private fields */ }
Implementations
impl ListExchangeRate
impl ListExchangeRate
List of exchange rates implementation.
pub fn new() -> ListExchangeRate
pub fn new() -> ListExchangeRate
pub fn add_exchange_rate(
&mut self,
from_code: &str,
to_code: &str,
exchange_rate: Decimal
) -> bool
pub fn add_exchange_rate(
&mut self,
from_code: &str,
to_code: &str,
exchange_rate: Decimal
) -> bool
Add a new exchange rate into the exchange rate list. The exchange rate is updated if it already exists.
Arguments
from_code
- International currency code “from”.to_code
- International currency code “to”.exchange_rate
- The exchange rate in “from” (unit) / “to” (unit).
Return
- True if successful, otherwise false.
pub fn copy_with_calc_manager(&self) -> ListExchangeRate
pub fn copy_with_calc_manager(&self) -> ListExchangeRate
Copy all exchange rates from the exchange rate list and return a new exchange rate list.
Return
- See description.
pub fn copy(&self) -> ListExchangeRate
pub fn copy(&self) -> ListExchangeRate
Copy all exchange rates from the exchange rate list and return a new exchange rate list.
Return
- See description.
pub fn convert_currency(
&self,
value: Decimal,
from_code: &str,
to_code: &str,
cross_rate_code: &str
) -> Decimal
pub fn convert_currency(
&self,
value: Decimal,
from_code: &str,
to_code: &str,
cross_rate_code: &str
) -> Decimal
Convert a value from one currency to another. Cross rates are used if the exchange rate is unavailable and the cross rate international currency code is not empty.
Arguments
value
- The value to convert.from_code
- International currency code “from”.to_code
- International currency code “to”.cross_rate_code
- International currency code used for cross rates.
Return
- See description.
pub fn exchange_rate(&self) -> Decimal
pub fn exchange_rate(&self) -> Decimal
pub fn get_element_by_name(&self, from_code: &str, to_code: &str) -> bool
pub fn get_element_by_name(&self, from_code: &str, to_code: &str) -> bool
pub fn remove(&mut self) -> bool
pub fn remove(&mut self) -> bool
Remove the selected exchange rate from the exchange rate list.
Return
- True if successful, otherwise false.
pub fn set_from_code(&mut self, from_code_param: &str) -> bool
pub fn set_from_code(&mut self, from_code_param: &str) -> bool
pub fn set_to_code(&mut self, to_code_param: &str) -> bool
pub fn set_to_code(&mut self, to_code_param: &str) -> bool
pub fn set_exchange_rate(&mut self, exchange_rate_param: Decimal) -> bool
pub fn set_exchange_rate(&mut self, exchange_rate_param: Decimal) -> bool
pub fn set_sort_on_add(&mut self, sort_on_add_param: bool) -> bool
pub fn set_sort_on_add(&mut self, sort_on_add_param: bool) -> bool
pub fn set_sort_updated(&mut self, sort_updated_param: bool) -> bool
pub fn set_sort_updated(&mut self, sort_updated_param: bool) -> bool
Trait Implementations
impl Default for ListExchangeRate
impl Default for ListExchangeRate
List of exchange rates default implementation.
impl ListTrait for ListExchangeRate
impl ListTrait for ListExchangeRate
List of exchange rates list implementation.
Auto Trait Implementations
impl !RefUnwindSafe for ListExchangeRate
impl Send for ListExchangeRate
impl !Sync for ListExchangeRate
impl Unpin for ListExchangeRate
impl UnwindSafe for ListExchangeRate
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more