Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion near-sdk/src/collections/lookup_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ use crate::{env, IntoStorageKey};

const ERR_ELEMENT_SERIALIZATION: &str = "Cannot serialize element with Borsh";

/// An non-iterable implementation of a set that stores its content directly on the trie.
/// A non-iterable implementation of a set that stores its content directly on the storage trie.
///
/// This set stores the values under a hash of the set's `prefix` and [`BorshSerialize`] of the
/// value.
#[derive(BorshSerialize, BorshDeserialize)]
pub struct LookupSet<T> {
element_prefix: Vec<u8>,
Expand Down
4 changes: 2 additions & 2 deletions near-sdk/src/store/lookup_map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const ERR_ELEMENT_SERIALIZATION: &str = "Cannot serialize element";
/// A non-iterable, lazily loaded storage map that stores its content directly on the storage trie.
///
/// This map stores the values under a hash of the map's `prefix` and [`BorshSerialize`] of the key
/// using the map's [`ToKey`] implementation.
/// and transformed using the map's [`ToKey`] implementation.
///
/// The default hash function for [`LookupMap`] is [`Identity`] which just prefixes the serialized
/// key object and uses these bytes as the key. This is to be backwards-compatible with
Expand All @@ -32,7 +32,7 @@ const ERR_ELEMENT_SERIALIZATION: &str = "Cannot serialize element";
/// ```
/// use near_sdk::store::LookupMap;
///
/// // Initializes a map, the generic types can be inferred to `LookupMap<String, u8, Sha256>`
/// // Initializes a map, the generic types can be inferred to `LookupMap<String, u8, Identity>`
/// // The `b"a"` parameter is a prefix for the storage keys of this data structure.
/// let mut map = LookupMap::new(b"a");
///
Expand Down
4 changes: 2 additions & 2 deletions near-sdk/src/store/lookup_set/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ use borsh::BorshSerialize;

impl<T, H> Extend<T> for LookupSet<T, H>
where
T: BorshSerialize + Ord,
T: BorshSerialize,
H: ToKey,
{
fn extend<I>(&mut self, iter: I)
where
I: IntoIterator<Item = T>,
{
iter.into_iter().for_each(move |elem| {
self.put(elem);
self.insert(elem);
});
}
}
Loading