Struct ExtractIf

#[must_use = "iterators are lazy and do nothing unless consumed; use `retain` to remove and discard elements"]
pub struct ExtractIf<'a, K, F, A: Allocator = Global> { pub(in ::collections::hash::set) base: ExtractIf<'a, K, F, A> }

A draining, filtering iterator over the items of a HashSet.

This struct is created by the extract_if method on HashSet.

Examples

use std::collections::HashSet;

let mut a = HashSet::from([1, 2, 3]);

let mut extract_ifed = a.extract_if(|v| v % 2 == 0);

Fields

base: ExtractIf<'a, K, F, A>

Trait Implementations

impl<K, F, A: Allocator> Debug for ExtractIf<'_, K, F, A> where K: Debug,

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

impl<K, F, A: Allocator> FusedIterator for ExtractIf<'_, K, F, A> where F: FnMut(&K) -> bool,

impl<K, F, A: Allocator> Iterator for ExtractIf<'_, K, F, A> where F: FnMut(&K) -> bool,

type Item = K;
fn next(&mut self) -> Option<K>
fn size_hint(&self) -> (usize, Option<usize>)

Auto Trait Implementations

impl<'a, K, F, A = Global> !UnwindSafe for ExtractIf<'a, K, F, A>

impl<'a, K, F, A> Freeze for ExtractIf<'a, K, F, A> where ExtractIf<'a, K, F, A>: Freeze,

impl<'a, K, F, A> RefUnwindSafe for ExtractIf<'a, K, F, A> where ExtractIf<'a, K, F, A>: RefUnwindSafe,

impl<'a, K, F, A> Send for ExtractIf<'a, K, F, A> where ExtractIf<'a, K, F, A>: Send,

impl<'a, K, F, A> Sync for ExtractIf<'a, K, F, A> where ExtractIf<'a, K, F, A>: Sync,

impl<'a, K, F, A> Unpin for ExtractIf<'a, K, F, A> where ExtractIf<'a, K, F, A>: Unpin,

impl<'a, K, F, A> UnsafeUnpin for ExtractIf<'a, K, F, A> where ExtractIf<'a, K, F, A>: UnsafeUnpin,

Blanket Implementations

impl<I> IntoIterator for ExtractIf<'a, K, F, A> where I: Iterator,

type Item = <I as Iterator>::Item;
type IntoIter = I;
fn into_iter(self) -> I

impl<T> Any for ExtractIf<'a, K, F, A> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for ExtractIf<'a, K, F, A> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for ExtractIf<'a, K, F, A> where T: ?Sized,

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

impl<T> From<T> for ExtractIf<'a, K, F, A>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for ExtractIf<'a, K, F, A> where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for ExtractIf<'a, K, F, A>

impl<T, U> Into<U> for ExtractIf<'a, K, F, A> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom<U> for ExtractIf<'a, K, F, A> where U: Into<T>,

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

impl<T, U> TryInto<U> for ExtractIf<'a, K, F, A> where U: TryFrom<T>,

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