Enum stellar_base::memo::Memo
source · 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 PartialEq for Memo
impl PartialEq for Memo
source§impl XDRDeserialize for Memo
impl XDRDeserialize for Memo
source§impl XDRSerialize for Memo
impl XDRSerialize for Memo
impl Eq for Memo
impl StructuralEq for Memo
impl StructuralPartialEq for Memo
Auto Trait Implementations§
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