pub struct TrieDiff<T = ()> { /* private fields */ }Implementations§
Source§impl<T> TrieDiff<T>
impl<T> TrieDiff<T>
Sourcepub fn diff_insert(
&mut self,
key: impl Into<Vec<u8>>,
value: impl Into<Vec<u8>>,
user_data: T,
) -> Option<(Option<Vec<u8>>, T)>
pub fn diff_insert( &mut self, key: impl Into<Vec<u8>>, value: impl Into<Vec<u8>>, user_data: T, ) -> Option<(Option<Vec<u8>>, T)>
Inserts the given key-value combination in the diff.
Returns the value associated to this key that was previously in the diff, if any.
Sourcepub fn diff_insert_erase(
&mut self,
key: impl Into<Vec<u8>>,
user_data: T,
) -> Option<(Option<Vec<u8>>, T)>
pub fn diff_insert_erase( &mut self, key: impl Into<Vec<u8>>, user_data: T, ) -> Option<(Option<Vec<u8>>, T)>
Inserts in the diff an entry at the given key that delete the value that is located in the base storage.
Returns the value associated to this key that was previously in the diff, if any.
Sourcepub fn diff_remove(
&mut self,
key: impl AsRef<[u8]>,
) -> Option<(Option<Vec<u8>>, T)>
pub fn diff_remove( &mut self, key: impl AsRef<[u8]>, ) -> Option<(Option<Vec<u8>>, T)>
Removes from the diff the entry corresponding to the given key.
Returns the value associated to this key that was previously in the diff, if any.
Sourcepub fn diff_get(&self, key: &[u8]) -> Option<(Option<&[u8]>, &T)>
pub fn diff_get(&self, key: &[u8]) -> Option<(Option<&[u8]>, &T)>
Returns the diff entry at the given key.
Returns None if the diff doesn’t have any entry for this key, and Some((None, _)) if
the diff has an entry that deletes the storage item.
Sourcepub fn diff_iter_unordered(
&self,
) -> impl ExactSizeIterator<Item = (&[u8], Option<&[u8]>, &T)> + Clone
pub fn diff_iter_unordered( &self, ) -> impl ExactSizeIterator<Item = (&[u8], Option<&[u8]>, &T)> + Clone
Returns an iterator to all the entries in the diff.
Each value is either Some if the diff overwrites this diff, or None if it erases the
underlying value.
Sourcepub fn diff_into_iter_unordered(
self,
) -> impl ExactSizeIterator<Item = (Vec<u8>, Option<Vec<u8>>, T)>
pub fn diff_into_iter_unordered( self, ) -> impl ExactSizeIterator<Item = (Vec<u8>, Option<Vec<u8>>, T)>
Returns an iterator to all the entries in the diff.
Each value is either Some if the diff overwrites this diff, or None if it erases the
underlying value.
Sourcepub fn diff_range_ordered<U>(
&self,
range: impl RangeBounds<U>,
) -> impl Iterator<Item = (&[u8], bool)> + Clone
pub fn diff_range_ordered<U>( &self, range: impl RangeBounds<U>, ) -> impl Iterator<Item = (&[u8], bool)> + Clone
Returns an iterator to all the entries in the diff within a given range.
Each iterator element is the given and a boolean. This boolean is true if the diff
overwrites this entry, or false if it erases the underlying value.
Sourcepub fn storage_next_key<'a>(
&'a self,
key: &[u8],
in_parent_next_key: Option<&'a [u8]>,
or_equal: bool,
) -> StorageNextKey<'a>
pub fn storage_next_key<'a>( &'a self, key: &[u8], in_parent_next_key: Option<&'a [u8]>, or_equal: bool, ) -> StorageNextKey<'a>
Returns the storage key that immediately follows the provided key. Must be passed the
storage key that immediately follows the provided key according to the base storage this
diff is based upon.
If StorageNextKey::Found is returned, it contains the desired key. If
StorageNextKey::NextOf is returned, then this function should be called again but by
passing the key found in the StorageNextKey::NextOf (and of course the corresponding
in_parent_next_key).
§Panic
Panics if in_parent_next_key is provided and is inferior or equal to key.
Trait Implementations§
impl<T> Eq for TrieDiff<T>where
T: Eq,
Auto Trait Implementations§
impl<T> Freeze for TrieDiff<T>
impl<T> RefUnwindSafe for TrieDiff<T>where
T: RefUnwindSafe,
impl<T> Send for TrieDiff<T>where
T: Send,
impl<T> Sync for TrieDiff<T>where
T: Sync,
impl<T> Unpin for TrieDiff<T>where
T: Unpin,
impl<T> UnsafeUnpin for TrieDiff<T>
impl<T> UnwindSafe for TrieDiff<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more