pub trait MapInstructions<F, AssignedKey, AssignedValue>{
type MapCPU: MapCPU<F, AssignedKey::Element, AssignedValue::Element>;
// Required methods
fn init(
&mut self,
layouter: &mut impl Layouter<F>,
map: Value<Self::MapCPU>,
) -> Result<(), Error>;
fn succinct_repr(&self) -> AssignedNative<F>;
fn insert(
&mut self,
layouter: &mut impl Layouter<F>,
key: &AssignedKey,
value: &AssignedValue,
) -> Result<(), Error>;
fn get(
&self,
layouter: &mut impl Layouter<F>,
key: &AssignedKey,
) -> Result<AssignedValue, Error>;
}Expand description
The set of circuit instructions for mapping operations.
Required Associated Types§
Required Methods§
Sourcefn init(
&mut self,
layouter: &mut impl Layouter<F>,
map: Value<Self::MapCPU>,
) -> Result<(), Error>
fn init( &mut self, layouter: &mut impl Layouter<F>, map: Value<Self::MapCPU>, ) -> Result<(), Error>
Initializes a new in-circuit map from the given off-circuit map.
Sourcefn succinct_repr(&self) -> AssignedNative<F>
fn succinct_repr(&self) -> AssignedNative<F>
A (cryptographically unequivocal) succinct representation of the map.
Sourcefn insert(
&mut self,
layouter: &mut impl Layouter<F>,
key: &AssignedKey,
value: &AssignedValue,
) -> Result<(), Error>
fn insert( &mut self, layouter: &mut impl Layouter<F>, key: &AssignedKey, value: &AssignedValue, ) -> Result<(), Error>
Inserts a new key -> value entry into the map. This call introduces in-circuit constraints that guarantee that the insertion was done correctly.
Sourcefn get(
&self,
layouter: &mut impl Layouter<F>,
key: &AssignedKey,
) -> Result<AssignedValue, Error>
fn get( &self, layouter: &mut impl Layouter<F>, key: &AssignedKey, ) -> Result<AssignedValue, Error>
Returns the value associated to a given key.
Unlike a standard HashMap every single key has a value in this
structure (possibly the default value it was created with).
This call introduces in-circuit constraints that guarantee that the
returned value is correct.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".