pub struct Currency(/* private fields */);
Expand description
Subtype of Value
that represents a currency
This is a wrapper around Fixed
that adds a currency symbol
Implementations§
source§impl Currency
impl Currency
sourcepub fn from_fixed(value: Fixed) -> Self
pub fn from_fixed(value: Fixed) -> Self
Create a new Currency
from a Fixed
sourcepub fn resolve(self, other: Self) -> (Self, Self)
pub fn resolve(self, other: Self) -> (Self, Self)
Resolve the precision of this Currency
with another Currency
Trait Implementations§
source§impl ArithmeticOperationExt for Currency
impl ArithmeticOperationExt for Currency
source§fn arithmetic_op(
self,
right: Self,
operation: ArithmeticOperation
) -> Result<Self, Error>
fn arithmetic_op( self, right: Self, operation: ArithmeticOperation ) -> Result<Self, Error>
Perform an arithmetic operation on two values
If the operation is not supported on the given type,
an
Error::UnsupportedOperation
will be returned Read moresource§impl BooleanOperationExt for Currency
impl BooleanOperationExt for Currency
source§fn boolean_op(
self,
right: Self,
operation: BooleanOperation
) -> Result<Value, Error>
fn boolean_op( self, right: Self, operation: BooleanOperation ) -> Result<Value, Error>
Perform a boolean operation on two values
If the operation is not supported on the given type,
an
Error::UnsupportedOperation
will be returned Read moresource§impl<'de> Deserialize<'de> for Currency
impl<'de> Deserialize<'de> for Currency
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<CurrencyInner> for Currency
impl From<CurrencyInner> for Currency
source§fn from(value: CurrencyInner) -> Self
fn from(value: CurrencyInner) -> Self
Converts to this type from the input type.
source§impl Into<CurrencyInner> for Currency
impl Into<CurrencyInner> for Currency
source§fn into(self) -> CurrencyInner
fn into(self) -> CurrencyInner
Converts this type into the (usually inferred) input type.
source§impl Ord for Currency
impl Ord for Currency
source§impl PartialEq for Currency
impl PartialEq for Currency
source§impl PartialOrd for Currency
impl PartialOrd for Currency
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl ValueTrait for Currency
impl ValueTrait for Currency
§type Inner = CurrencyInner
type Inner = CurrencyInner
The inner type of the value
source§fn new(inner: CurrencyInner) -> Self
fn new(inner: CurrencyInner) -> Self
Creates a new value from the given inner value
source§fn inner(&self) -> &CurrencyInner
fn inner(&self) -> &CurrencyInner
Returns a reference to the inner value
source§fn inner_mut(&mut self) -> &mut CurrencyInner
fn inner_mut(&mut self) -> &mut CurrencyInner
Returns a mutable reference to the inner value
source§fn into_inner(self) -> CurrencyInner
fn into_inner(self) -> CurrencyInner
Consumes the value and returns the inner value
impl Eq for Currency
impl StructuralPartialEq for Currency
Auto Trait Implementations§
impl Freeze for Currency
impl RefUnwindSafe for Currency
impl Send for Currency
impl Sync for Currency
impl Unpin for Currency
impl UnwindSafe for Currency
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