Struct keyed_set::KeyedSet

source ·
pub struct KeyedSet<T, Extractor, S = DefaultHashBuilder> { /* private fields */ }

Implementations§

source§

impl<T, Extractor> KeyedSet<T, Extractor>where Extractor: for<'a> KeyExtractor<'a, T>, for<'a> <Extractor as KeyExtractor<'a, T>>::Key: Hash,

source

pub fn new(extractor: Extractor) -> Self

source§

impl<T, Extractor, S> KeyedSet<T, Extractor, S>where Extractor: for<'a> KeyExtractor<'a, T>, for<'a> <Extractor as KeyExtractor<'a, T>>::Key: Hash, S: BuildHasher,

source

pub fn insert(&mut self, value: T) -> Option<T>where for<'a, 'b> <Extractor as KeyExtractor<'a, T>>::Key: PartialEq<<Extractor as KeyExtractor<'b, T>>::Key>,

source

pub fn entry<'a, K>(&'a mut self, key: K) -> Entry<'a, T, Extractor, K, S>where K: Hash, for<'z> <Extractor as KeyExtractor<'z, T>>::Key: Hash + PartialEq<K>,

source

pub fn write(&mut self, value: T) -> &mut Twhere for<'a, 'b> <Extractor as KeyExtractor<'a, T>>::Key: PartialEq<<Extractor as KeyExtractor<'b, T>>::Key>,

source

pub fn get<K>(&self, key: &K) -> Option<&T>where K: Hash, for<'a> <Extractor as KeyExtractor<'a, T>>::Key: Hash + PartialEq<K>,

source

pub fn get_mut<'a, K>( &'a mut self, key: &'a K ) -> Option<KeyedSetGuard<'a, K, T, Extractor>>where K: Hash, for<'z> <Extractor as KeyExtractor<'z, T>>::Key: Hash + PartialEq<K>,

source

pub fn get_mut_unguarded<'a, K>(&'a mut self, key: &K) -> Option<&'a mut T>where K: Hash, for<'z> <Extractor as KeyExtractor<'z, T>>::Key: Hash + PartialEq<K>,

source

pub fn remove<K>(&mut self, key: &K) -> Option<T>where K: Hash, for<'z> <Extractor as KeyExtractor<'z, T>>::Key: Hash + PartialEq<K>,

source

pub fn drain_where<F: FnMut(&mut T) -> bool>( &mut self, predicate: F ) -> DrainFilter<'_, T, F>

Returns an iterator that drains elements that match the provided predicate, while removing them from the set.

Note that DrainFilter WILL iterate fully on drop, ensuring that all elements matching your predicate are always removed, even if you fail to iterate.

source

pub fn drain(&mut self) -> Drain<'_, T>

Returns an iterator that drains elements from the collection, without affecting the collection’s capacity.

Note that Drain WILL iterate fully on drop, ensuring that all elements are indeed removed, even if you fail to iterate.

source§

impl<T, Extractor, S> KeyedSet<T, Extractor, S>

source

pub fn iter(&self) -> Iter<'_, T>

source

pub fn iter_mut(&mut self) -> IterMut<'_, T>

source

pub fn len(&self) -> usize

source

pub fn is_empty(&self) -> bool

Trait Implementations§

source§

impl<T: Clone, Extractor: Clone, S: Clone> Clone for KeyedSet<T, Extractor, S>

source§

fn clone(&self) -> KeyedSet<T, Extractor, S>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug, Extractor, S> Debug for KeyedSet<T, Extractor, S>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T, Extractor: Default, S: Default> Default for KeyedSet<T, Extractor, S>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<T, Extractor, S, Borrower> IEntry<T, Extractor, S, Borrower> for KeyedSet<T, Extractor, S>where Extractor: for<'a> KeyExtractor<'a, T>, for<'a> <Extractor as KeyExtractor<'a, T>>::Key: Hash, S: BuildHasher,

source§

fn entry<'a, K>(&'a mut self, key: K) -> Entry<'a, T, Extractor, K, S>where Borrower: IBorrower<K>, <Borrower as IBorrower<K>>::Borrowed: Hash, for<'z> <Extractor as KeyExtractor<'z, T>>::Key: Hash + PartialEq<<Borrower as IBorrower<K>>::Borrowed>,

source§

impl<'a, T, Extractor, S> IntoIterator for &'a KeyedSet<T, Extractor, S>

§

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?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<'a, T, Extractor, S> IntoIterator for &'a mut KeyedSet<T, Extractor, S>

§

type Item = &'a mut T

The type of the elements being iterated over.
§

type IntoIter = IterMut<'a, T>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<T, Extractor, S> RefUnwindSafe for KeyedSet<T, Extractor, S>where Extractor: RefUnwindSafe, S: RefUnwindSafe, T: RefUnwindSafe,

§

impl<T, Extractor, S> Send for KeyedSet<T, Extractor, S>where Extractor: Send, S: Send, T: Send,

§

impl<T, Extractor, S> Sync for KeyedSet<T, Extractor, S>where Extractor: Sync, S: Sync, T: Sync,

§

impl<T, Extractor, S> Unpin for KeyedSet<T, Extractor, S>where Extractor: Unpin, S: Unpin, T: Unpin,

§

impl<T, Extractor, S> UnwindSafe for KeyedSet<T, Extractor, S>where Extractor: UnwindSafe, S: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.