pub enum TrustLineAsset {
Native,
Credit(CreditAsset),
PoolShare(LiquidityPoolId),
}Expand description
Represent an asset associated with a trustline, either a regular asset or a liquidity pool’s shares
Variants§
Native
Credit(CreditAsset)
Implementations§
Source§impl TrustLineAsset
impl TrustLineAsset
Sourcepub fn new_native() -> Self
pub fn new_native() -> Self
Create the native asset: Lumens.
Sourcepub fn new_credit<S>(code: S, issuer: PublicKey) -> Result<Self>
pub fn new_credit<S>(code: S, issuer: PublicKey) -> Result<Self>
Create the asset with code issued by issuer.
Create a trustline asset for a liquidity pool shares.
Sourcepub fn is_native(&self) -> bool
pub fn is_native(&self) -> bool
Returns true if the asset is a Native. Returns false otherwise.
Sourcepub fn is_credit(&self) -> bool
pub fn is_credit(&self) -> bool
Returns true if the asset is a Credit. Returns false otherwise.
Sourcepub fn as_credit(&self) -> Option<&CreditAsset>
pub fn as_credit(&self) -> Option<&CreditAsset>
If the asset is a Credit, returns its value. Returns None otherwise
Sourcepub fn as_credit_mut(&mut self) -> Option<&mut CreditAsset>
pub fn as_credit_mut(&mut self) -> Option<&mut CreditAsset>
If the asset is a Credit, returns its mutable value. Returns None otherwise
Sourcepub fn to_xdr(&self) -> Result<TrustLineAsset>
pub fn to_xdr(&self) -> Result<TrustLineAsset>
Returns the trustline asset xdr object.
Sourcepub fn from_xdr(x: &TrustLineAsset) -> Result<Self>
pub fn from_xdr(x: &TrustLineAsset) -> Result<Self>
Creates an asset from the xdr object.
Trait Implementations§
Source§impl Clone for TrustLineAsset
impl Clone for TrustLineAsset
Source§fn clone(&self) -> TrustLineAsset
fn clone(&self) -> TrustLineAsset
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TrustLineAsset
impl Debug for TrustLineAsset
Source§impl From<Asset> for TrustLineAsset
impl From<Asset> for TrustLineAsset
Source§impl PartialEq for TrustLineAsset
impl PartialEq for TrustLineAsset
Source§impl ReadXdr for TrustLineAsset
impl ReadXdr for TrustLineAsset
Source§fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self>
fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self>
Read the XDR and construct the type. Read more
Source§fn read_xdr_to_end<R>(r: &mut Limited<R>) -> Result<Self, Error>where
R: Read,
fn read_xdr_to_end<R>(r: &mut Limited<R>) -> Result<Self, Error>where
R: Read,
Read the XDR and construct the type, and consider it an error if the
read does not completely consume the read implementation. Read more
Source§fn read_xdr_into<R>(&mut self, r: &mut Limited<R>) -> Result<(), Error>where
R: Read,
fn read_xdr_into<R>(&mut self, r: &mut Limited<R>) -> Result<(), Error>where
R: Read,
Read the XDR and construct the type. Read more
Source§fn read_xdr_into_to_end<R>(&mut self, r: &mut Limited<R>) -> Result<(), Error>where
R: Read,
fn read_xdr_into_to_end<R>(&mut self, r: &mut Limited<R>) -> Result<(), Error>where
R: Read,
Read the XDR into the existing value, and consider it an error if the
read does not completely consume the read implementation. Read more
Source§fn read_xdr_iter<R>(r: &mut Limited<R>) -> ReadXdrIter<&mut R, Self> ⓘwhere
R: Read,
fn read_xdr_iter<R>(r: &mut Limited<R>) -> ReadXdrIter<&mut R, Self> ⓘwhere
R: Read,
Create an iterator that reads the read implementation as a stream of
values that are read into the implementing type. Read more
Source§impl WriteXdr for TrustLineAsset
impl WriteXdr for TrustLineAsset
impl Eq for TrustLineAsset
impl StructuralPartialEq for TrustLineAsset
Auto Trait Implementations§
impl Freeze for TrustLineAsset
impl RefUnwindSafe for TrustLineAsset
impl Send for TrustLineAsset
impl Sync for TrustLineAsset
impl Unpin for TrustLineAsset
impl UnwindSafe for TrustLineAsset
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