[][src]Enum stellar_base::asset::Asset

pub enum Asset {
    Native,
    Credit(CreditAsset),
}

Represent an asset, either the native asset (XLM) or an asset issued.

Variants

Native

The native asset (XLM).

Credit(CreditAsset)

A non-native asset, identified by asset code/issuer id.

Implementations

impl Asset[src]

pub fn new_native() -> Asset[src]

Create the native asset: Lumens.

pub fn new_credit<S>(code: S, issuer: PublicKey) -> Result<Asset> where
    S: Into<String>, 
[src]

Create the asset with code issued by issuer.

pub fn is_native(&self) -> bool[src]

Returns true if the asset is a Native. Returns false otherwise.

pub fn as_credit(&self) -> Option<&CreditAsset>[src]

If the asset is a Credit, returns its value. Returns None otherwise

pub fn as_credit_mut(&mut self) -> Option<&mut CreditAsset>[src]

If the asset is a Credit, returns its mutable value. Returns None otherwise

pub fn is_credit(&self) -> bool[src]

Returns true if the asset is a Credit. Returns false otherwise.

pub fn to_xdr(&self) -> Result<Asset>[src]

Returns the asset xdr object.

pub fn from_xdr(x: &Asset) -> Result<Asset>[src]

Creates an asset from the xdr object.

Trait Implementations

impl Clone for Asset[src]

impl Debug for Asset[src]

impl Eq for Asset[src]

impl PartialEq<Asset> for Asset[src]

impl StructuralEq for Asset[src]

impl StructuralPartialEq for Asset[src]

impl XDRDeserialize for Asset[src]

impl XDRSerialize for Asset[src]

Auto Trait Implementations

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.