pub trait StorageBatchMutate<Type: Mappable>: StorageMutate<Type> {
// Required methods
fn init_storage<'a, Iter>(&mut self, set: Iter) -> Result<()>
where Iter: 'a + Iterator<Item = (&'a Type::Key, &'a Type::Value)>,
Type::Key: 'a,
Type::Value: 'a;
fn insert_batch<'a, Iter>(&mut self, set: Iter) -> Result<()>
where Iter: 'a + Iterator<Item = (&'a Type::Key, &'a Type::Value)>,
Type::Key: 'a,
Type::Value: 'a;
fn remove_batch<'a, Iter>(&mut self, set: Iter) -> Result<()>
where Iter: 'a + Iterator<Item = &'a Type::Key>,
Type::Key: 'a;
}
Expand description
The traits allow work with the storage in batches. Some implementations can perform batch operations faster than one by one.
Required Methods§
Sourcefn init_storage<'a, Iter>(&mut self, set: Iter) -> Result<()>
fn init_storage<'a, Iter>(&mut self, set: Iter) -> Result<()>
Initialize the storage with batch insertion. This method is more performant than
Self::insert_batch
in some cases.
§Errors
Returns an error if the storage is already initialized.
Sourcefn insert_batch<'a, Iter>(&mut self, set: Iter) -> Result<()>
fn insert_batch<'a, Iter>(&mut self, set: Iter) -> Result<()>
Inserts the key-value pair into the storage in batch.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.