Struct miden_objects::transaction::OutputNotes
source · pub struct OutputNotes<T: ToEnvelope = OutputNote> { /* private fields */ }Expand description
Contains a list of output notes of a transaction. The list can be empty if the transaction does not produce any notes.
For the purposes of this struct, anything that can be reduced to a note envelope can be an output note. However, ToEnvelope trait is currently implemented only for OutputNote and NoteEnvelope, and so these are the only two allowed output note types.
Implementations§
source§impl<T: ToEnvelope> OutputNotes<T>
impl<T: ToEnvelope> OutputNotes<T>
sourcepub fn new(notes: Vec<T>) -> Result<Self, TransactionOutputError>
pub fn new(notes: Vec<T>) -> Result<Self, TransactionOutputError>
Returns new OutputNotes instantiated from the provide vector of notes.
§Errors
Returns an error if:
- The total number of notes is greater than 1024.
- The vector of notes contains duplicates.
sourcepub fn commitment(&self) -> Digest
pub fn commitment(&self) -> Digest
Returns the commitment to the output notes.
The commitment is computed as a sequential hash of (hash, metadata) tuples for the notes created in a transaction.
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if this OutputNotes does not contain any notes.
sourcepub fn get_note(&self, idx: usize) -> &T
pub fn get_note(&self, idx: usize) -> &T
Returns a reference to the note located at the specified index.
sourcepub fn iter(&self) -> impl Iterator<Item = &T>
pub fn iter(&self) -> impl Iterator<Item = &T>
Returns an iterator over notes in this OutputNotes.
Trait Implementations§
source§impl<T: Clone + ToEnvelope> Clone for OutputNotes<T>
impl<T: Clone + ToEnvelope> Clone for OutputNotes<T>
source§fn clone(&self) -> OutputNotes<T>
fn clone(&self) -> OutputNotes<T>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl<T: Debug + ToEnvelope> Debug for OutputNotes<T>
impl<T: Debug + ToEnvelope> Debug for OutputNotes<T>
source§impl Default for OutputNotes
impl Default for OutputNotes
source§impl<T: ToEnvelope> Deserializable for OutputNotes<T>
impl<T: ToEnvelope> Deserializable for OutputNotes<T>
source§fn read_from<R: ByteReader>(
source: &mut R
) -> Result<Self, DeserializationError>
fn read_from<R: ByteReader>( source: &mut R ) -> Result<Self, DeserializationError>
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 From<OutputNotes> for OutputNotes<NoteEnvelope>
impl From<OutputNotes> for OutputNotes<NoteEnvelope>
source§fn from(notes: OutputNotes) -> Self
fn from(notes: OutputNotes) -> Self
source§impl<T: ToEnvelope> IntoIterator for OutputNotes<T>
impl<T: ToEnvelope> IntoIterator for OutputNotes<T>
source§impl<T: ToEnvelope> PartialEq for OutputNotes<T>
impl<T: ToEnvelope> PartialEq for OutputNotes<T>
source§impl<T: ToEnvelope> Serializable for OutputNotes<T>
impl<T: ToEnvelope> Serializable for OutputNotes<T>
source§fn write_into<W: ByteWriter>(&self, target: &mut W)
fn write_into<W: ByteWriter>(&self, target: &mut W)
self into bytes and writes these bytes into the target.