pub struct RecordingMap<K, V> { /* private fields */ }
Expand description

A RecordingMap that records read requests to the underlying key-value map.

The data recorder is used to generate a proof for read requests.

The RecordingMap is composed of three parts:

  • data: which contains the current set of key-value pairs in the map.
  • updates: which tracks keys for which values have been changed since the map was instantiated. updates include both insertions, removals and updates of values under existing keys.
  • trace: which contains the key-value pairs from the original data which have been accesses since the map was instantiated.

Implementations§

§

impl<K, V> RecordingMap<K, V>
where K: Ord + Clone, V: Clone,

pub fn new(init: impl IntoIterator<Item = (K, V)>) -> RecordingMap<K, V>

Returns a new RecordingMap instance initialized with the provided key-value pairs. (BTreeMap).

pub fn inner(&self) -> &BTreeMap<K, V>

pub fn finalize(self) -> (BTreeMap<K, V>, BTreeMap<K, V>)

Consumes the RecordingMap and returns a (BTreeMap, BTreeMap) tuple. The first element of the tuple is a map that represents the state of the map at the time .finalize() is called. The second element contains the key-value pairs from the initial data set that were read during recording.

Trait Implementations§

§

impl<K, V> Clone for RecordingMap<K, V>
where K: Clone, V: Clone,

§

fn clone(&self) -> RecordingMap<K, V>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<K, V> Debug for RecordingMap<K, V>
where K: Debug, V: Debug,

§

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

Formats the value using the given formatter. Read more
§

impl<K, V> Default for RecordingMap<K, V>
where K: Default, V: Default,

§

fn default() -> RecordingMap<K, V>

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

impl<K, V> Extend<(K, V)> for RecordingMap<K, V>
where K: Clone + Ord, V: Clone,

§

fn extend<T>(&mut self, iter: T)
where T: IntoIterator<Item = (K, V)>,

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
§

impl<K, V> FromIterator<(K, V)> for RecordingMap<K, V>
where K: Clone + Ord, V: Clone,

§

fn from_iter<T>(iter: T) -> RecordingMap<K, V>
where T: IntoIterator<Item = (K, V)>,

Creates a value from an iterator. Read more
§

impl<K, V> IntoIterator for RecordingMap<K, V>
where K: Clone + Ord, V: Clone,

§

type Item = (K, V)

The type of the elements being iterated over.
§

type IntoIter = IntoIter<K, V>

Which kind of iterator are we turning this into?
§

fn into_iter(self) -> <RecordingMap<K, V> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
§

impl<K, V> KvMap<K, V> for RecordingMap<K, V>
where K: Ord + Clone, V: Clone,

§

fn get(&self, key: &K) -> Option<&V>

Returns a reference to the value associated with the given key if the value exists.

If the key is part of the initial data set, the key access is recorded.

§

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

Returns a boolean to indicate whether the given key exists in the data set.

If the key is part of the initial data set, the key access is recorded.

§

fn len(&self) -> usize

Returns the number of key-value pairs in the data set.

§

fn insert(&mut self, key: K, value: V) -> Option<V>

Inserts a key-value pair into the data set.

If the key already exists in the data set, the value is updated and the old value is returned.

§

fn remove(&mut self, key: &K) -> Option<V>

Removes a key-value pair from the data set.

If the key exists in the data set, the old value is returned.

§

fn iter(&self) -> Box<dyn Iterator<Item = (&K, &V)> + '_>

Returns an iterator over the key-value pairs in the data set.

§

fn is_empty(&self) -> bool

§

impl<K, V> PartialEq for RecordingMap<K, V>
where K: PartialEq, V: PartialEq,

§

fn eq(&self, other: &RecordingMap<K, V>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<K, V> Eq for RecordingMap<K, V>
where K: Eq, V: Eq,

§

impl<K, V> StructuralPartialEq for RecordingMap<K, V>

Auto Trait Implementations§

§

impl<K, V> !RefUnwindSafe for RecordingMap<K, V>

§

impl<K, V> Send for RecordingMap<K, V>
where K: Send, V: Send,

§

impl<K, V> !Sync for RecordingMap<K, V>

§

impl<K, V> Unpin for RecordingMap<K, V>

§

impl<K, V> UnwindSafe for RecordingMap<K, V>

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

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

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>,

§

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>,

§

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

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more