Struct AdviceMap

Source
pub struct AdviceMap(/* private fields */);
Expand description

Defines a set of non-deterministic (advice) inputs which the VM can access by their keys.

Each key maps to one or more field element. To access the elements, the VM can move the values associated with a given key onto the advice stack using adv.push_mapval instruction. The VM can also insert new values into the advice map during execution.

Implementations§

Source§

impl AdviceMap

Source

pub fn new() -> Self

Creates a new advice map.

Source

pub fn get(&self, key: &RpoDigest) -> Option<&[Felt]>

Returns the values associated with given key.

Source

pub fn insert(&mut self, key: RpoDigest, value: Vec<Felt>) -> Option<Vec<Felt>>

Inserts a key value pair in the advice map and returns the inserted value.

Source

pub fn remove(&mut self, key: &RpoDigest) -> Option<Vec<Felt>>

Removes the value associated with the key and returns the removed element.

Source

pub fn len(&self) -> usize

Returns the number of key value pairs in the advice map.

Source

pub fn is_empty(&self) -> bool

Returns true if the advice map is empty.

Trait Implementations§

Source§

impl Clone for AdviceMap

Source§

fn clone(&self) -> AdviceMap

Returns a duplicate 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 AdviceMap

Source§

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

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

impl Default for AdviceMap

Source§

fn default() -> AdviceMap

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

impl Deserializable for AdviceMap

Source§

fn read_from<R: ByteReader>( source: &mut R, ) -> Result<Self, DeserializationError>

Reads a sequence of bytes from the provided source, attempts to deserialize these bytes into Self, and returns the result. Read more
Source§

fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>

Attempts to deserialize the provided bytes into Self and returns the result. Read more
Source§

impl Extend<(RpoDigest, Vec<BaseElement>)> for AdviceMap

Source§

fn extend<T: IntoIterator<Item = (RpoDigest, Vec<Felt>)>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl From<BTreeMap<RpoDigest, Vec<BaseElement>>> for AdviceMap

Source§

fn from(value: BTreeMap<RpoDigest, Vec<Felt>>) -> Self

Converts to this type from the input type.
Source§

impl FromIterator<(RpoDigest, Vec<BaseElement>)> for AdviceMap

Source§

fn from_iter<T: IntoIterator<Item = (RpoDigest, Vec<Felt>)>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl IntoIterator for AdviceMap

Source§

type Item = (RpoDigest, Vec<BaseElement>)

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<RpoDigest, Vec<BaseElement>>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl KvMap<RpoDigest, Vec<BaseElement>> for AdviceMap

Source§

fn get(&self, key: &RpoDigest) -> Option<&Vec<Felt>>

Source§

fn contains_key(&self, key: &RpoDigest) -> bool

Source§

fn len(&self) -> usize

Source§

fn insert(&mut self, key: RpoDigest, value: Vec<Felt>) -> Option<Vec<Felt>>

Source§

fn remove(&mut self, key: &RpoDigest) -> Option<Vec<Felt>>

Source§

fn iter(&self) -> Box<dyn Iterator<Item = (&RpoDigest, &Vec<Felt>)> + '_>

Source§

fn is_empty(&self) -> bool

Source§

impl PartialEq for AdviceMap

Source§

fn eq(&self, other: &AdviceMap) -> 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 Serializable for AdviceMap

Source§

fn write_into<W: ByteWriter>(&self, target: &mut W)

Serializes self into bytes and writes these bytes into the target.
Source§

fn to_bytes(&self) -> Vec<u8>

Serializes self into a vector of bytes.
Source§

fn get_size_hint(&self) -> usize

Returns an estimate of how many bytes are needed to represent self. Read more
Source§

impl Eq for AdviceMap

Source§

impl StructuralPartialEq for AdviceMap

Auto Trait Implementations§

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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

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

Source§

fn vzip(self) -> V