Enum Memo

Source
pub enum Memo {
    Empty,
    Text(TextMemo),
    Future(MemoBytes),
    Arbitrary(Box<[u8; 511]>),
}
Expand description

An unencrypted memo received alongside a shielded note in a Zcash transaction.

Variants§

§

Empty

An empty memo field.

§

Text(TextMemo)

A memo field containing a UTF-8 string.

§

Future(MemoBytes)

Some unknown memo format from ✨the future✨ that we can’t parse.

§

Arbitrary(Box<[u8; 511]>)

A memo field containing arbitrary bytes.

Implementations§

Source§

impl Memo

Source

pub fn from_bytes(bytes: &[u8]) -> Result<Self, Error>

Parses a Memo from its ZIP 302 serialization.

Returns an error if the provided slice does not represent a valid Memo (for example, if the slice is not 512 bytes, or the encoded Memo is non-canonical).

Source

pub fn encode(&self) -> MemoBytes

Serializes the Memo per ZIP 302.

Trait Implementations§

Source§

impl Clone for Memo

Source§

fn clone(&self) -> Memo

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Memo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Memo

Source§

fn default() -> Memo

Returns the “default value” for a type. Read more
Source§

impl From<&Memo> for MemoBytes

Source§

fn from(memo: &Memo) -> Self

Serializes the Memo per ZIP 302.

Source§

impl From<Memo> for MemoBytes

Source§

fn from(memo: Memo) -> Self

Serializes the Memo per ZIP 302.

Source§

impl FromStr for Memo

Source§

fn from_str(memo: &str) -> Result<Self, Self::Err>

Returns a Memo containing the given string, or an error if the string is too long.

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

impl PartialEq for Memo

Source§

fn eq(&self, rhs: &Memo) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<&MemoBytes> for Memo

Source§

fn try_from(bytes: &MemoBytes) -> Result<Self, Self::Error>

Parses a Memo from its ZIP 302 serialization.

Returns an error if the provided slice does not represent a valid Memo (for example, if the slice is not 512 bytes, or the encoded Memo is non-canonical).

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<MemoBytes> for Memo

Source§

fn try_from(bytes: MemoBytes) -> Result<Self, Self::Error>

Parses a Memo from its ZIP 302 serialization.

Returns an error if the provided slice does not represent a valid Memo (for example, if the slice is not 512 bytes, or the encoded Memo is non-canonical).

Source§

type Error = Error

The type returned in the event of a conversion error.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V