[−][src]Struct ckb_util::LinkedHashSet
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
impl<T: Hash + Eq> LinkedHashSet<T, BuildHasherDefault<DefaultHasher>>
[src]
pub fn new() -> LinkedHashSet<T, BuildHasherDefault<DefaultHasher>>
[src]
Creates a linked hash set.
Examples
use ckb_util::LinkedHashSet; let set: LinkedHashSet<i32> = LinkedHashSet::new();
impl<T, S> LinkedHashSet<T, S> where
T: Eq + Hash,
S: BuildHasher,
[src]
T: Eq + Hash,
S: BuildHasher,
pub fn contains(&self, value: &T) -> bool
[src]
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);
pub fn capacity(&self) -> usize
[src]
Returns the number of elements the set can hold without reallocating.
pub fn len(&self) -> usize
[src]
Returns the number of elements in the set.
pub fn is_empty(&self) -> bool
[src]
Returns true
if the set contains no elements.
pub fn insert(&mut self, value: T) -> bool
[src]
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.
pub fn iter(&self) -> Iter<'_, T>
[src]
Gets an iterator visiting all elements in insertion order.
The iterator element type is &'a T
.
pub fn difference<'a>(
&'a self,
other: &'a LinkedHashSet<T, S>
) -> Difference<'a, T, S>
[src]
&'a self,
other: &'a LinkedHashSet<T, S>
) -> Difference<'a, T, S>
Visits the values representing the difference, i.e., the values that are in self
but not in other
.
Trait Implementations
impl<T: Hash + Eq> Default for LinkedHashSet<T, BuildHasherDefault<DefaultHasher>>
[src]
pub fn default() -> LinkedHashSet<T, BuildHasherDefault<DefaultHasher>>
[src]
Creates an empty HashSet<T>
with the Default
value for the hasher.
impl<T, S> Extend<T> for LinkedHashSet<T, S> where
T: Eq + Hash,
S: BuildHasher,
[src]
T: Eq + Hash,
S: BuildHasher,
pub fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
[src]
pub fn extend_one(&mut self, item: A)
[src]
pub fn extend_reserve(&mut self, additional: usize)
[src]
impl<'a, T, S> IntoIterator for &'a LinkedHashSet<T, S> where
T: Eq + Hash,
S: BuildHasher,
[src]
T: Eq + Hash,
S: BuildHasher,
type Item = &'a T
The type of the elements being iterated over.
type IntoIter = Iter<'a, T>
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> Iter<'a, T>
[src]
impl<T, S> IntoIterator for LinkedHashSet<T, S> where
T: Eq + Hash,
S: BuildHasher,
[src]
T: Eq + Hash,
S: BuildHasher,
Auto Trait Implementations
impl<T, S> RefUnwindSafe for LinkedHashSet<T, S> where
S: RefUnwindSafe,
T: RefUnwindSafe,
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, S> Send for LinkedHashSet<T, S> where
S: Send,
T: Send,
S: Send,
T: Send,
impl<T, S> Sync for LinkedHashSet<T, S> where
S: Sync,
T: Sync,
S: Sync,
T: Sync,
impl<T, S> Unpin for LinkedHashSet<T, S> where
S: Unpin,
S: Unpin,
impl<T, S> UnwindSafe for LinkedHashSet<T, S> where
S: UnwindSafe,
T: RefUnwindSafe,
S: UnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Erased for T
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,