pub struct LookupSet<T, H = Identity> where
    T: BorshSerialize + Ord,
    H: ToKey
{ /* private fields */ }

Implementations

Initialize new LookupSet with the prefix provided.

This prefix can be anything that implements IntoStorageKey. The prefix is used when storing and looking up values in storage to ensure no collisions with other collections.

Initialize a LookupSet with a custom hash function.

Example
use near_sdk::store::{LookupSet, key::Keccak256};

let map = LookupSet::<String, Keccak256>::with_hasher(b"m");

Returns true if the set contains the specified value.

The value may be any borrowed form of the set’s value type, but BorshSerialize, ToOwned<Owned = T> and Ord on the borrowed form must match those for the value type.

Adds a value to the set.

If the set did not have this value present, true is returned.

If the set did have this value present, false is returned.

Puts the given value into the set.

This function will not return whether the passed value was already in the set. Use LookupSet::insert if you need that.

Removes a value from the set. Returns whether the value was present in the set.

The value may be any borrowed form of the set’s value type, but BorshSerialize, ToOwned<Owned = K> and Ord on the borrowed form must match those for the value type.

Flushes the intermediate values of the set before this is called when the structure is Droped. This will write all modified values to storage but keep all cached values in memory.

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.

Serialize this instance into a vector of bytes.

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Extends a collection with the contents of an iterator. Read more

🔬This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

🔬This is a nightly-only experimental API. (extend_one)

Reserves capacity in a collection for the given number of additional elements. 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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.