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
impl AdviceMap
Sourcepub fn insert(&mut self, key: Word, value: Vec<Felt>) -> Option<Vec<Felt>>
pub fn insert(&mut self, key: Word, value: Vec<Felt>) -> Option<Vec<Felt>>
Inserts a key value pair in the advice map and returns the inserted value.
Sourcepub fn remove(&mut self, key: &Word) -> Option<Vec<Felt>>
pub fn remove(&mut self, key: &Word) -> Option<Vec<Felt>>
Removes the value associated with the key and returns the removed element.
Sourcepub fn merge_advice_map(
&mut self,
other: &AdviceMap,
) -> Result<(), ((Word, Vec<Felt>), Vec<Felt>)>
pub fn merge_advice_map( &mut self, other: &AdviceMap, ) -> Result<(), ((Word, Vec<Felt>), Vec<Felt>)>
Merges all entries from the given AdviceMap
into the current advice map.
If an entry from the new map already exists with the same key but different value, an error is returned containing the existing entry along with the value that would replace it. The current map remains unchanged.
Trait Implementations§
Source§impl Deserializable for AdviceMap
impl Deserializable for AdviceMap
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 Extend<(Word, Vec<BaseElement>)> for AdviceMap
impl Extend<(Word, Vec<BaseElement>)> for AdviceMap
Source§fn extend<T: IntoIterator<Item = (Word, Vec<Felt>)>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = (Word, Vec<Felt>)>>(&mut self, iter: T)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Source§impl FromIterator<(Word, Vec<BaseElement>)> for AdviceMap
impl FromIterator<(Word, Vec<BaseElement>)> for AdviceMap
Source§impl IntoIterator for AdviceMap
impl IntoIterator for AdviceMap
Source§impl KvMap<Word, Vec<BaseElement>> for AdviceMap
impl KvMap<Word, Vec<BaseElement>> for AdviceMap
fn get(&self, key: &Word) -> Option<&Vec<Felt>>
fn contains_key(&self, key: &Word) -> bool
fn len(&self) -> usize
fn insert(&mut self, key: Word, value: Vec<Felt>) -> Option<Vec<Felt>>
fn remove(&mut self, key: &Word) -> Option<Vec<Felt>>
fn iter(&self) -> Box<dyn Iterator<Item = (&Word, &Vec<Felt>)> + '_>
fn is_empty(&self) -> bool
Source§impl Serializable for AdviceMap
impl Serializable for AdviceMap
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
.