Skip to main content

StorageDispatcher

Trait StorageDispatcher 

Source
pub trait StorageDispatcher {
    type Storage;

    // Required method
    fn with_storage<T, F>(&mut self, default_value: T, operation: F) -> T
       where F: FnOnce(&mut Self::Storage) -> T;

    // Provided methods
    fn with_storage_result<F>(&mut self, operation: F) -> StorageResult<()>
       where F: FnOnce(&mut Self::Storage) -> StorageResult<()> { ... }
    fn with_storage_value<T, F>(&mut self, operation: F) -> StorageResult<T>
       where F: FnOnce(&mut Self::Storage) -> StorageResult<T>,
             T: Default { ... }
}
Expand description

Хелпер-трейт для упрощения диспетчеризации

Required Associated Types§

Required Methods§

Source

fn with_storage<T, F>(&mut self, default_value: T, operation: F) -> T
where F: FnOnce(&mut Self::Storage) -> T,

Provided Methods§

Source

fn with_storage_result<F>(&mut self, operation: F) -> StorageResult<()>
where F: FnOnce(&mut Self::Storage) -> StorageResult<()>,

Source

fn with_storage_value<T, F>(&mut self, operation: F) -> StorageResult<T>
where F: FnOnce(&mut Self::Storage) -> StorageResult<T>, T: Default,

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.

Implementors§