[][src]Enum merx::asset::asset::Asset

#[repr(align(8))]pub enum Asset<T: CheckedOps> {
    Debt(Debt<T>),
    Credit(Credit<T>),
}

Can be either a Credit or a Debt

Assets that wraps the same type can be added: a Debt is always less then 0 and a Credit is always bigger or equal to 0, so only the addition is supported.

Assets can be multiplied or divided for i128 and TODO for floating point

Assets can be created from integer values or tuples TODO link

The value of an assets can be extract as an i128 or as a tuple TODO link

Variants

Debt(Debt<T>)
Credit(Credit<T>)

Methods

impl<T: CheckedOps> Asset<T>[src]

pub fn get_inner(self) -> T[src]

Return the numeric value of the Asset

impl<V: CheckedOps + TryFrom<i128>> Asset<V>[src]

pub fn new<T: Into<i128>>(val: T) -> Option<Self>[src]

Trait Implementations

impl<T: CheckedOps> Add<Asset<T>> for Asset<T>[src]

type Output = Option<Asset<T>>

The resulting type after applying the + operator.

impl<T: Clone + CheckedOps> Clone for Asset<T>[src]

impl<T: Copy + CheckedOps> Copy for Asset<T>[src]

impl<T: Debug + CheckedOps> Debug for Asset<T>[src]

impl<T: CheckedOps> Div<i128> for Asset<T>[src]

type Output = Option<Asset<T>>

The resulting type after applying the / operator.

impl<T: Eq + CheckedOps> Eq for Asset<T>[src]

impl<T: Hash + CheckedOps> Hash for Asset<T>[src]

impl<T: CheckedOps> Mul<i128> for Asset<T>[src]

type Output = Option<Asset<T>>

The resulting type after applying the * operator.

impl<T: Ord + CheckedOps> Ord for Asset<T>[src]

impl<T: PartialEq + CheckedOps> PartialEq<Asset<T>> for Asset<T>[src]

impl<T: PartialOrd + CheckedOps> PartialOrd<Asset<T>> for Asset<T>[src]

impl<T: CheckedOps> StructuralEq for Asset<T>[src]

impl<T: CheckedOps> StructuralPartialEq for Asset<T>[src]

impl<I: TryInto<i128>, F: TryInto<u128>, T: TryFrom<(i128, F)> + CheckedOps> TryFrom<(I, F)> for Asset<T>[src]

type Error = ()

The type returned in the event of a conversion error.

impl<T: TryFrom<f64> + CheckedOps> TryFrom<f64> for Asset<T>[src]

type Error = ()

The type returned in the event of a conversion error.

impl<T: TryFrom<i128> + CheckedOps> TryFrom<i128> for Asset<T>[src]

type Error = ()

The type returned in the event of a conversion error.

Auto Trait Implementations

impl<T> RefUnwindSafe for Asset<T> where
    T: RefUnwindSafe

impl<T> Send for Asset<T> where
    T: Send

impl<T> Sync for Asset<T> where
    T: Sync

impl<T> Unpin for Asset<T> where
    T: Unpin

impl<T> UnwindSafe for Asset<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.