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 get(&self, key: &RpoDigest) -> Option<&[Felt]>
pub fn get(&self, key: &RpoDigest) -> Option<&[Felt]>
Returns the values associated with given key.
Sourcepub fn insert(&mut self, key: RpoDigest, value: Vec<Felt>) -> Option<Vec<Felt>>
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.
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>
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 Extend<(RpoDigest, Vec<BaseElement>)> for AdviceMap
impl Extend<(RpoDigest, Vec<BaseElement>)> for AdviceMap
Source§fn extend<T: IntoIterator<Item = (RpoDigest, Vec<Felt>)>>(&mut self, iter: T)
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)
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)
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 FromIterator<(RpoDigest, Vec<BaseElement>)> for AdviceMap
impl FromIterator<(RpoDigest, Vec<BaseElement>)> for AdviceMap
Source§impl IntoIterator for AdviceMap
impl IntoIterator for AdviceMap
Source§impl KvMap<RpoDigest, Vec<BaseElement>> for AdviceMap
impl KvMap<RpoDigest, Vec<BaseElement>> for AdviceMap
fn get(&self, key: &RpoDigest) -> Option<&Vec<Felt>>
fn contains_key(&self, key: &RpoDigest) -> bool
fn len(&self) -> usize
fn insert(&mut self, key: RpoDigest, value: Vec<Felt>) -> Option<Vec<Felt>>
fn remove(&mut self, key: &RpoDigest) -> Option<Vec<Felt>>
fn iter(&self) -> Box<dyn Iterator<Item = (&RpoDigest, &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)
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
impl Eq for AdviceMap
impl StructuralPartialEq for AdviceMap
Auto Trait Implementations§
impl Freeze for AdviceMap
impl RefUnwindSafe for AdviceMap
impl Send for AdviceMap
impl Sync for AdviceMap
impl Unpin for AdviceMap
impl UnwindSafe for AdviceMap
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