pub trait StorableType {
type Handler;
const LAYOUT: Layout;
const SLOTS: usize = _;
const BYTES: usize = _;
const IS_PACKABLE: bool = _;
const IS_DYNAMIC: bool = false;
// Required method
fn handle(slot: U256, ctx: LayoutCtx, address: Address) -> Self::Handler;
}Expand description
Helper trait to access storage layout information without requiring const generic parameter.
This trait provides compile-time layout information (slot count, byte size, packability) and a factory method for creating handlers. It enables the derive macro to compute struct layouts before the final slot count is known.
NOTE: Don’t need to implement the trait manually. Use #[derive(Storable)] instead.
Required Associated Constants§
Provided Associated Constants§
Sourceconst IS_PACKABLE: bool = _
const IS_PACKABLE: bool = _
Whether this type can be packed with adjacent fields.
Sourceconst IS_DYNAMIC: bool = false
const IS_DYNAMIC: bool = false
Whether this type stores it’s data in its base slot or not.
Dynamic types (Bytes, String, Vec) store data at keccak256-addressed
slots and need special cleanup. Non-dynamic types just zero their slots.
Required Associated Types§
Required Methods§
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.