Skip to main content

MapInstructions

Trait MapInstructions 

Source
pub trait MapInstructions<F, AssignedKey, AssignedValue>
where F: CircuitField, AssignedKey: InnerValue, AssignedValue: InnerValue,
{ 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§

Source

type MapCPU: MapCPU<F, AssignedKey::Element, AssignedValue::Element>

The CPU version of the map.

Required Methods§

Source

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.

Source

fn succinct_repr(&self) -> AssignedNative<F>

A (cryptographically unequivocal) succinct representation of the map.

Source

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.

Source

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".

Implementors§