Struct ckb_util::LinkedHashSet [−][src]
pub struct LinkedHashSet<T, S = BuildHasherDefault<DefaultHasher>> { /* fields omitted */ }Expand description
A HashSet that holds elements in insertion order.
Examples
use ckb_util::LinkedHashSet;
let mut set = LinkedHashSet::new();
set.insert(2);
set.insert(1);
set.insert(3);
let items: Vec<i32> = set.iter().copied().collect();
assert_eq!(items, [2, 1, 3]);Implementations
Returns true if the set contains a value.
use ckb_util::LinkedHashSet;
let mut set: LinkedHashSet<_> = LinkedHashSet::new();
set.insert(1);
set.insert(2);
set.insert(3);
assert_eq!(set.contains(&1), true);
assert_eq!(set.contains(&4), false);Returns the number of elements the set can hold without reallocating.
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.
Gets an iterator visiting all elements in insertion order.
The iterator element type is &'a T.
Visits the values representing the difference, i.e., the values that are in self but not in other.
Trait Implementations
Creates an empty HashSet<T> with the Default value for the hasher.
Extends a collection with the contents of an iterator. Read more
extend_one)Extends a collection with exactly one element.
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more