Struct miden_client::notes::NoteMetadata
source · pub struct NoteMetadata { /* private fields */ }Expand description
Metadata associated with a note.
Note type and tag must be internally consistent according to the following rules:
- For off-chain notes, the most significant bit of the tag must be 0.
- For public notes, the second most significant bit of the tag must be 0.
- For encrypted notes, two most significant bits of the tag must be 00.
Implementations§
source§impl NoteMetadata
impl NoteMetadata
sourcepub fn new(
sender: AccountId,
note_type: NoteType,
tag: NoteTag,
aux: BaseElement,
) -> Result<NoteMetadata, NoteError>
pub fn new( sender: AccountId, note_type: NoteType, tag: NoteTag, aux: BaseElement, ) -> Result<NoteMetadata, NoteError>
Returns a new NoteMetadata instantiated with the specified parameters.
§Errors
Returns an error if the note type and note tag are inconsistent.
sourcepub fn aux(&self) -> BaseElement
pub fn aux(&self) -> BaseElement
Returns the note’s aux field.
sourcepub fn is_offchain(&self) -> bool
pub fn is_offchain(&self) -> bool
Returns true if the note is off-chain.
Trait Implementations§
source§impl Clone for NoteMetadata
impl Clone for NoteMetadata
source§fn clone(&self) -> NoteMetadata
fn clone(&self) -> NoteMetadata
Returns a copy 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 NoteMetadata
impl Debug for NoteMetadata
source§impl Deserializable for NoteMetadata
impl Deserializable for NoteMetadata
source§fn read_from<R>(source: &mut R) -> Result<NoteMetadata, DeserializationError>where
R: ByteReader,
fn read_from<R>(source: &mut R) -> Result<NoteMetadata, DeserializationError>where
R: ByteReader,
Reads a sequence of bytes from the provided
source, attempts to deserialize these bytes
into Self, and returns the result. Read moresource§fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>
fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>
source§impl<'de> Deserialize<'de> for NoteMetadata
impl<'de> Deserialize<'de> for NoteMetadata
source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<NoteMetadata, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<NoteMetadata, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<&NoteMetadata> for [BaseElement; 4]
impl From<&NoteMetadata> for [BaseElement; 4]
source§fn from(metadata: &NoteMetadata) -> [BaseElement; 4]
fn from(metadata: &NoteMetadata) -> [BaseElement; 4]
Converts to this type from the input type.
source§impl From<NoteMetadata> for [BaseElement; 4]
impl From<NoteMetadata> for [BaseElement; 4]
source§fn from(metadata: NoteMetadata) -> [BaseElement; 4]
fn from(metadata: NoteMetadata) -> [BaseElement; 4]
Converts to this type from the input type.
source§impl PartialEq for NoteMetadata
impl PartialEq for NoteMetadata
source§fn eq(&self, other: &NoteMetadata) -> bool
fn eq(&self, other: &NoteMetadata) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl Serializable for NoteMetadata
impl Serializable for NoteMetadata
source§fn write_into<W>(&self, target: &mut W)where
W: ByteWriter,
fn write_into<W>(&self, target: &mut W)where
W: ByteWriter,
Serializes
self into bytes and writes these bytes into the target.source§fn get_size_hint(&self) -> usize
fn get_size_hint(&self) -> usize
Returns an estimate of how many bytes are needed to represent self. Read more
source§impl Serialize for NoteMetadata
impl Serialize for NoteMetadata
source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
source§impl TryFrom<[BaseElement; 4]> for NoteMetadata
impl TryFrom<[BaseElement; 4]> for NoteMetadata
source§fn try_from(
elements: [BaseElement; 4],
) -> Result<NoteMetadata, <NoteMetadata as TryFrom<[BaseElement; 4]>>::Error>
fn try_from( elements: [BaseElement; 4], ) -> Result<NoteMetadata, <NoteMetadata as TryFrom<[BaseElement; 4]>>::Error>
Performs the conversion.
impl Copy for NoteMetadata
impl Eq for NoteMetadata
impl StructuralPartialEq for NoteMetadata
Auto Trait Implementations§
impl Freeze for NoteMetadata
impl RefUnwindSafe for NoteMetadata
impl Send for NoteMetadata
impl Sync for NoteMetadata
impl Unpin for NoteMetadata
impl UnwindSafe for NoteMetadata
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)