Struct SymmetricDifference

#[must_use = "this returns the difference as an iterator, without modifying either input set"]
pub struct SymmetricDifference<'a, T: 'a, S: 'a, A: Allocator = Global> { pub(in ::collections::hash::set) iter: Chain<Difference<'a, T, S, A>, Difference<'a, T, S, A>> }

A lazy iterator producing elements in the symmetric difference of HashSets.

This struct is created by the symmetric_difference method on HashSet. See its documentation for more.

Examples

use std::collections::HashSet;

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

let mut intersection = a.symmetric_difference(&b);

Fields

iter: Chain<Difference<'a, T, S, A>, Difference<'a, T, S, A>>

Trait Implementations

impl<'a, T, S, A> Iterator for SymmetricDifference<'a, T, S, A> where T: Eq + Hash, S: BuildHasher, A: Allocator,

type Item = &'a T;
fn next(&mut self) -> Option<&'a T>
fn size_hint(&self) -> (usize, Option<usize>)
fn fold<B, F>(self, init: B, f: F) -> B
where
    Self: Sized,
    F: FnMut(B, Self::Item) -> B,

impl<T, S, A> Debug for SymmetricDifference<'_, T, S, A> where T: Debug + Eq + Hash, S: BuildHasher, A: Allocator,

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

impl<T, S, A> FusedIterator for SymmetricDifference<'_, T, S, A> where T: Eq + Hash, S: BuildHasher, A: Allocator,

impl<T, S, A: Allocator> Clone for SymmetricDifference<'_, T, S, A>

fn clone(&self) -> Self

Auto Trait Implementations

impl<'a, T, S, A> Freeze for SymmetricDifference<'a, T, S, A> where Chain<Difference<'a, T, S, A>, Difference<'a, T, S, A>>: Freeze,

impl<'a, T, S, A> RefUnwindSafe for SymmetricDifference<'a, T, S, A> where Chain<Difference<'a, T, S, A>, Difference<'a, T, S, A>>: RefUnwindSafe,

impl<'a, T, S, A> Send for SymmetricDifference<'a, T, S, A> where Chain<Difference<'a, T, S, A>, Difference<'a, T, S, A>>: Send,

impl<'a, T, S, A> Sync for SymmetricDifference<'a, T, S, A> where Chain<Difference<'a, T, S, A>, Difference<'a, T, S, A>>: Sync,

impl<'a, T, S, A> Unpin for SymmetricDifference<'a, T, S, A> where Chain<Difference<'a, T, S, A>, Difference<'a, T, S, A>>: Unpin,

impl<'a, T, S, A> UnsafeUnpin for SymmetricDifference<'a, T, S, A> where Chain<Difference<'a, T, S, A>, Difference<'a, T, S, A>>: UnsafeUnpin,

impl<'a, T, S, A> UnwindSafe for SymmetricDifference<'a, T, S, A> where Chain<Difference<'a, T, S, A>, Difference<'a, T, S, A>>: UnwindSafe,

Blanket Implementations

impl<I> IntoIterator for SymmetricDifference<'a, T, S, A> where I: Iterator,

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

impl<T> Any for SymmetricDifference<'a, T, S, A> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for SymmetricDifference<'a, T, S, A> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for SymmetricDifference<'a, T, S, A> where T: ?Sized,

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

impl<T> CloneToUninit for SymmetricDifference<'a, T, S, A> where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for SymmetricDifference<'a, T, S, A>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for SymmetricDifference<'a, T, S, A> where T: ?Sized,

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

impl<T> SizedTypeProperties for SymmetricDifference<'a, T, S, A>

impl<T> ToOwned for SymmetricDifference<'a, T, S, A> where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for SymmetricDifference<'a, T, S, 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 SymmetricDifference<'a, T, S, 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 SymmetricDifference<'a, T, S, A> where U: TryFrom<T>,

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