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§
fn with_storage<T, F>(&mut self, default_value: T, operation: F) -> T
Provided Methods§
fn with_storage_result<F>(&mut self, operation: F) -> StorageResult<()>
fn with_storage_value<T, F>(&mut self, operation: F) -> StorageResult<T>
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.