Struct near_sdk::collections::LazyOption[][src]

pub struct LazyOption<T> { /* fields omitted */ }
Expand description

An persistent lazy option, that stores a value in the storage.

Implementations

Returns true if the value is present in the storage.

Returns true if the value is not present in the storage.

Create a new lazy option with the given storage_key and the initial value.

Removes the value from storage without reading it. Returns whether the value was present.

Removes the value from storage and returns it as an option.

Gets the value from storage and returns it as an option.

Sets the value into the storage without reading the previous value and returns whether the previous value was present.

Replaces the value in the storage and returns the previous value as an option.

Trait Implementations

Deserializes this instance from a given slice of bytes. Updates the buffer to point at the remaining bytes. Read more

Deserialize this instance from a slice of bytes.

Whether Self is u8. NOTE: Vec<u8> is the most common use-case for serialization and deserialization, it’s worth handling it as a special case to improve performance. It’s a workaround for specific Vec<u8> implementation versus generic Vec<T> implementation. See https://github.com/rust-lang/rfcs/pull/1210 for details. Read more

Serialize this instance into a vector of bytes.

Whether Self is u8. NOTE: Vec<u8> is the most common use-case for serialization and deserialization, it’s worth handling it as a special case to improve performance. It’s a workaround for specific Vec<u8> implementation versus generic Vec<T> implementation. See https://github.com/rust-lang/rfcs/pull/1210 for details. 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.

Should always be Self

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.