pub enum Memo {
None,
Text(String),
Id(u64),
Hash([u8; 32]),
Return([u8; 32]),
}Expand description
Memo attached to transactions.
Variants§
None
No memo
Text(String)
Text Memo
Id(u64)
Id Memo
Hash([u8; 32])
Hash Memo
Return([u8; 32])
Return Memo
Implementations§
Source§impl Memo
impl Memo
Sourcepub fn new_text<S: Into<String>>(text: S) -> Result<Memo>
pub fn new_text<S: Into<String>>(text: S) -> Result<Memo>
Create new text memo. text must be shorter than 28 bytes.
Sourcepub fn new_return(ret: &[u8]) -> Result<Memo>
pub fn new_return(ret: &[u8]) -> Result<Memo>
Creates new return memo.
Sourcepub fn as_id(&self) -> Option<&u64>
pub fn as_id(&self) -> Option<&u64>
If the memo is an Id, returns its value. Returns None otherwise.
Sourcepub fn as_id_mut(&mut self) -> Option<&mut u64>
pub fn as_id_mut(&mut self) -> Option<&mut u64>
If the memo is an Id, returns its mutable value. Returns None otherwise.
Sourcepub fn as_text(&self) -> Option<&str>
pub fn as_text(&self) -> Option<&str>
If the memo is a Text, returns its value. Returns None otherwise.
Sourcepub fn as_text_mut(&mut self) -> Option<&mut str>
pub fn as_text_mut(&mut self) -> Option<&mut str>
If the memo is a Text, returns its value. Returns None otherwise.
Sourcepub fn as_hash(&self) -> Option<&[u8; 32]>
pub fn as_hash(&self) -> Option<&[u8; 32]>
If the memo is a Hash, returns its value. Returns None otherwise.
Sourcepub fn as_hash_mut(&mut self) -> Option<&mut [u8; 32]>
pub fn as_hash_mut(&mut self) -> Option<&mut [u8; 32]>
If the memo is a Hash, returns its mutable value. Returns None otherwise.
Sourcepub fn as_return(&self) -> Option<&[u8; 32]>
pub fn as_return(&self) -> Option<&[u8; 32]>
If the memo is a Return, returns its value. Returns None otherwise.
Sourcepub fn as_return_mut(&mut self) -> Option<&mut [u8; 32]>
pub fn as_return_mut(&mut self) -> Option<&mut [u8; 32]>
If the memo is a Return, returns its mutable value. Returns None otherwise.
Trait Implementations§
Source§impl ReadXdr for Memo
impl ReadXdr for Memo
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
impl Eq for Memo
impl StructuralPartialEq for Memo
Auto Trait Implementations§
impl Freeze for Memo
impl RefUnwindSafe for Memo
impl Send for Memo
impl Sync for Memo
impl Unpin for Memo
impl UnwindSafe for Memo
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