pub struct MemoBytes(/* private fields */);
Expand description
The unencrypted memo bytes received alongside a shielded note in a Zcash transaction.
Implementations§
Source§impl MemoBytes
impl MemoBytes
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, Error>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, Error>
Creates a MemoBytes
from a slice, exactly as provided.
Returns an error if the provided slice is longer than 512 bytes. Slices shorter than 512 bytes are padded with null bytes.
Note that passing an empty slice to this API (or an all-zeroes slice) will result
in a memo representing an empty string. What you almost certainly want in this
case is MemoBytes::empty
, which uses a specific encoding to indicate that no
memo is present.
Sourcepub fn as_array(&self) -> &[u8; 512]
pub fn as_array(&self) -> &[u8; 512]
Returns the raw byte array containing the memo bytes, including null padding.
Sourcepub fn into_bytes(self) -> [u8; 512]
pub fn into_bytes(self) -> [u8; 512]
Consumes this MemoBytes
value and returns the underlying byte array.
Trait Implementations§
Source§impl Ord for MemoBytes
impl Ord for MemoBytes
Source§impl PartialOrd for MemoBytes
impl PartialOrd for MemoBytes
Source§impl TryFrom<&MemoBytes> for Memo
impl TryFrom<&MemoBytes> for Memo
Source§impl TryFrom<MemoBytes> for Memo
impl TryFrom<MemoBytes> for Memo
impl Eq for MemoBytes
Auto Trait Implementations§
impl Freeze for MemoBytes
impl RefUnwindSafe for MemoBytes
impl Send for MemoBytes
impl Sync for MemoBytes
impl Unpin for MemoBytes
impl UnwindSafe for MemoBytes
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more