Struct miden_objects::notes::NoteInputs
source · pub struct NoteInputs { /* private fields */ }Expand description
An container for note inputs.
A note can be associated with up to 128 input values. Each value is represented by a single field element. Thus, note input values can contain up to ~1 KB of data.
All inputs associated with a note can be reduced to a single commitment which is computed by first padding the inputs with ZEROs to the next multiple of 8, and then by computing a sequential hash of the resulting elements.
Implementations§
source§impl NoteInputs
impl NoteInputs
sourcepub fn new(values: Vec<Felt>) -> Result<Self, NoteError>
pub fn new(values: Vec<Felt>) -> Result<Self, NoteError>
Returns NoteInputs instantiated from the provided values.
§Errors
Returns an error if the number of provided inputs is greater than 128.
sourcepub fn commitment(&self) -> Digest
pub fn commitment(&self) -> Digest
Returns a commitment to these inputs.
sourcepub fn num_values(&self) -> u8
pub fn num_values(&self) -> u8
Returns the number of input values.
The returned value is guaranteed to be smaller than or equal to 128.
sourcepub fn to_padded_values(&self) -> Vec<Felt>
pub fn to_padded_values(&self) -> Vec<Felt>
Returns a vector of input values padded with ZEROs to the next multiple of 8.
Trait Implementations§
source§impl Clone for NoteInputs
impl Clone for NoteInputs
source§fn clone(&self) -> NoteInputs
fn clone(&self) -> NoteInputs
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for NoteInputs
impl Debug for NoteInputs
source§impl Deserializable for NoteInputs
impl Deserializable for NoteInputs
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 PartialEq for NoteInputs
impl PartialEq for NoteInputs
source§impl Serializable for NoteInputs
impl Serializable for NoteInputs
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.