Struct ink_storage::Box [−][src]
pub struct Box<T> where
T: SpreadLayout, { /* fields omitted */ }
Expand description
A dynamically allocated storage entity.
Users can use this in order to make certain SpreadLayout
storage entities
used in contexts that require a PackedLayout
storage entity by simply
packing the storage entity within a storage::Box
.
Dynamic allocations caused by the creation of storage::Box
instances do
have some limited overhead:
- The dynamic allocation itself has to be provided by some dynamic storage allocator that needs to be invoked.
- Each dynamic storage allocation implies roughly 1.12 bits of overhead.
- Upon ever first dereferencing of a
storage::Box
instance a cryptographic hash routine is run in order to compute the underlying storage key.
Use this abstraction with caution due to the aforementioned performance implications.
Implementations
Trait Implementations
Mutably borrows from an owned value. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
Pulls an instance of Self
from the contract storage. Read more
Pushes an instance of Self
to the contract storage. Read more
Clears an instance of Self
from the contract storage. Read more
Indicates whether a type requires deep clean-up of its state meaning that
a clean-up routine has to decode an entity into an instance in order to
eventually recurse upon its tear-down.
This is not required for the majority of primitive data types such as i32
,
however types such as storage::Box
that might want to forward the clean-up
procedure to their inner T
require a deep clean-up. Read more
Auto Trait Implementations
impl<T> !RefUnwindSafe for Box<T>
impl<T> UnwindSafe for Box<T> where
T: UnwindSafe,
Blanket Implementations
pub fn as_byte_slice(&self) -> &[u8]
pub fn as_mut_byte_slice(&mut self) -> &mut [u8]
pub fn as_mut_slice_of<T>(&mut self) -> Result<&mut [T], Error> where
T: FromByteSlice,
pub fn as_slice_of<T>(&self) -> Result<&[T], Error> where
T: FromByteSlice,
Mutably borrows from an owned value. Read more
fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
Convert from a value of T
into an equivalent instance of Self
. Read more
fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of T
. Read more
pub fn unique_saturated_into(self) -> T
pub fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of T
.