pub trait Storable {
// Required methods
fn __load_storage(field: &StoragePath) -> Self;
fn __save_storage(&mut self, field: &StoragePath);
}
Expand description
Storable trait provides functions as wrapper to getter and setter to the key-value storage in world-state. Impl of this trait is generated by macro. To avoid conflict with user function, function names in this trait are prefix with two underscores.
Required Methods§
Sourcefn __load_storage(field: &StoragePath) -> Self
fn __load_storage(field: &StoragePath) -> Self
the implementation should eventually call get() to obtain data from world-state and assign the value to the fields of struct
Sourcefn __save_storage(&mut self, field: &StoragePath)
fn __save_storage(&mut self, field: &StoragePath)
the implementation should eventually call set() to obtain fields’ value of struct and save it to world-state
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.