pub trait Storable:
'static
+ RuntimeType
+ EncodeLike { }Expand description
Lifetime-independent, fully owned runtime type safe for on-chain storage.
Extends RuntimeType with a 'static guarantee, ensuring the type
contains no non-static borrows (e.g. &'a T) and can be reliably encoded,
decoded, and persisted across deterministic runtime execution boundaries.
Since runtime storage reconstructs values purely from their encoded form,
any type containing temporary lifetimes cannot be safely restored. Requiring
'static guarantees the value is fully owned and stable across calls,
blocks, and forks.
The [EncodeLike] bound further ensures that equivalent representations
(e.g. owned vs borrowed views or transparent wrappers) produce the same
canonical SCALE encoding, enabling consistent storage access and matching
across interchangeable forms.
Use this for storage items, events, and any value that must survive beyond the current execution context.
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.