Struct ink_storage::Lazy[][src]

pub struct Lazy<T> where
    T: SpreadLayout
{ /* fields omitted */ }
Expand description

A lazy storage entity.

This loads its value from storage upon first use.

Note

Use this if the storage field does not need to be loaded in some or most cases.

Implementations

Creates an eagerly populated lazy storage value.

Returns a shared reference to the lazily loaded value.

Note

This loads the value from the contract storage if this did not happen before.

Panics

If loading from contract storage failed.

Returns an exclusive reference to the lazily loaded value.

Note

This loads the value from the contract storage if this did not happen before.

Panics

If loading from contract storage failed.

Sets the value to value, without executing any reads.

Note

No reads from contract storage will be executed.

This method should be preferred over dereferencing or get_mut in case the returned value is of no interest to the caller.

Panics

If accessing the inner value fails.

Trait Implementations

Performs the conversion.

Performs the conversion.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

Formats the value using the given formatter. Read more

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

This method tests greater than (for self and other) and is used by the > operator. Read more

The footprint of the type. 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

Returns the static storage layout of Self. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Should always be Self

Convert from a value of T into an equivalent instance of Self. Read more

Consume self to return an equivalent value of T. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Consume self to return an equivalent value of T.