[−][src]Enum stellar_base::asset::Asset
Represent an asset, either the native asset (XLM) or an asset issued.
Variants
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]
S: Into<String>,
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]
fn from_xdr_bytes(buffer: &[u8]) -> Result<(Self, u64)>[src]
fn from_xdr_base64(encoded: &str) -> Result<Self>[src]
impl XDRSerialize for Asset[src]
Auto Trait Implementations
impl RefUnwindSafe for Asset
impl Send for Asset
impl Sync for Asset
impl Unpin for Asset
impl UnwindSafe for Asset
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,