wasmtime_environ::wasmparser::collections::set

Struct Set

source
pub struct Set<T> { /* private fields */ }
Expand description

A default set of values.

Provides an API compatible with both HashSet and BTreeSet.

Implementations§

source§

impl<T> Set<T>

source

pub fn clear(&mut self)

Clears the Set, removing all elements.

source

pub fn retain<F>(&mut self, f: F)
where T: Ord, F: FnMut(&T) -> bool,

Retains only the elements specified by the predicate.

In other words, remove all elements e for which f(&e) returns false. The elements are visited in unsorted (and unspecified) order.

source

pub fn len(&self) -> usize

Returns the number of elements in the Set.

source

pub fn is_empty(&self) -> bool

Returns true if the Set contains no elements.

source

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

Returns an iterator that yields the items in the Set.

source§

impl<T> Set<T>
where T: Eq + Hash + Ord,

source

pub fn reserve(&mut self, additional: usize)

Reserves capacity for at least additional more elements to be inserted in the Set.

source

pub fn contains<Q>(&self, value: &Q) -> bool
where T: Borrow<Q>, Q: Hash + Eq + Ord + ?Sized,

Returns true if the Set contains an element equal to the value.

source

pub fn get<Q>(&self, value: &Q) -> Option<&T>
where T: Borrow<Q>, Q: Hash + Eq + Ord + ?Sized,

Returns a reference to the element in the Set, if any, that is equal to the value.

source

pub fn insert(&mut self, value: T) -> bool

Adds value to the Set.

Returns whether the value was newly inserted:

  • Returns true if the set did not previously contain an equal value.
  • Returns false otherwise and the entry is not updated.
source

pub fn remove<Q>(&mut self, value: &Q) -> bool
where T: Borrow<Q>, Q: Hash + Eq + Ord + ?Sized,

If the set contains an element equal to the value, removes it from the Set and drops it.

Returns true if such an element was present, otherwise false.

source

pub fn take<Q>(&mut self, value: &Q) -> Option<T>
where T: Borrow<Q>, Q: Hash + Ord + ?Sized,

Removes and returns the element in the Set, if any, that is equal to the value.

The value may be any borrowed form of the set’s element type, but the ordering on the borrowed form must match the ordering on the element type.

source

pub fn replace(&mut self, value: T) -> Option<T>

Adds a value to the Set, replacing the existing value, if any, that is equal to the given one. Returns the replaced value.

source

pub fn is_disjoint(&self, other: &Set<T>) -> bool

Returns true if self has no elements in common with other. This is equivalent to checking for an empty intersection.

source

pub fn is_subset(&self, other: &Set<T>) -> bool

Returns true if the Set is a subset of another, i.e., other contains at least all the values in self.

source

pub fn is_superset(&self, other: &Set<T>) -> bool

Returns true if the Set is a superset of another, i.e., self contains at least all the values in other.

source

pub fn difference<'a>(&'a self, other: &'a Set<T>) -> Difference<'a, T>

Visits the values representing the difference, i.e., the values that are in self but not in other.

source

pub fn symmetric_difference<'a>( &'a self, other: &'a Set<T>, ) -> SymmetricDifference<'a, T>

Visits the values representing the symmetric difference, i.e., the values that are in self or in other but not in both.

source

pub fn intersection<'a>(&'a self, other: &'a Set<T>) -> Intersection<'a, T>

Visits the values representing the intersection, i.e., the values that are both in self and other.

When an equal element is present in self and other then the resulting Intersection may yield references to one or the other. This can be relevant if T contains fields which are not compared by its Eq implementation, and may hold different value between the two equal copies of T in the two sets.

source

pub fn union<'a>(&'a self, other: &'a Set<T>) -> Union<'a, T>

Visits the values representing the union, i.e., all the values in self or other, without duplicates.

Trait Implementations§

source§

impl<'a, T> BitAnd for &'a Set<T>
where T: Eq + Hash + Ord + Clone + 'a,

source§

type Output = Set<T>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &'a Set<T>) -> Set<T>

Performs the & operation. Read more
source§

impl<'a, T> BitOr for &'a Set<T>
where T: Eq + Hash + Ord + Clone + 'a,

source§

type Output = Set<T>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &'a Set<T>) -> Set<T>

Performs the | operation. Read more
source§

impl<'a, T> BitXor for &'a Set<T>
where T: Eq + Hash + Ord + Clone + 'a,

source§

type Output = Set<T>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &'a Set<T>) -> Set<T>

Performs the ^ operation. Read more
source§

impl<T> Clone for Set<T>
where T: Clone,

source§

fn clone(&self) -> Set<T>

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 for Set<T>
where T: Debug,

source§

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

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

impl<T> Default for Set<T>

source§

fn default() -> Set<T>

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

impl<'a, T> Deserialize<'a> for Set<T>
where T: Deserialize<'a> + Eq + Hash + Ord,

source§

fn deserialize<D>( deserializer: D, ) -> Result<Set<T>, <D as Deserializer<'a>>::Error>
where D: Deserializer<'a>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<'a, T> Extend<&'a T> for Set<T>
where T: Hash + Eq + Ord + Copy + 'a,

source§

fn extend<Iter>(&mut self, iter: Iter)
where Iter: IntoIterator<Item = &'a T>,

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl<T> Extend<T> for Set<T>
where T: Hash + Eq + Ord,

source§

fn extend<Iter>(&mut self, iter: Iter)
where Iter: IntoIterator<Item = T>,

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl<T> FromIterator<T> for Set<T>
where T: Hash + Eq + Ord,

source§

fn from_iter<I>(iter: I) -> Set<T>
where I: IntoIterator<Item = T>,

Creates a value from an iterator. Read more
source§

impl<'a, T> IntoIterator for &'a Set<T>

source§

type Item = &'a T

The type of the elements being iterated over.
source§

type IntoIter = Iter<'a, T>

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

fn into_iter(self) -> <&'a Set<T> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
source§

impl<T> IntoIterator for Set<T>

source§

type Item = T

The type of the elements being iterated over.
source§

type IntoIter = IntoIter<T>

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

fn into_iter(self) -> <Set<T> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
source§

impl<T> PartialEq for Set<T>
where T: Eq + Hash,

source§

fn eq(&self, other: &Set<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> Serialize for Set<T>
where T: Serialize + Eq + Hash + Ord,

source§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<'a, T> Sub for &'a Set<T>
where T: Eq + Hash + Ord + Clone + 'a,

source§

type Output = Set<T>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &'a Set<T>) -> Set<T>

Performs the - operation. Read more
source§

impl<T> Eq for Set<T>
where T: Eq + Hash,

Auto Trait Implementations§

§

impl<T> Freeze for Set<T>

§

impl<T> RefUnwindSafe for Set<T>
where T: RefUnwindSafe,

§

impl<T> Send for Set<T>
where T: Send,

§

impl<T> Sync for Set<T>
where T: Sync,

§

impl<T> Unpin for Set<T>
where T: Unpin,

§

impl<T> UnwindSafe for Set<T>
where T: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

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 T
where T: Clone,

source§

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 T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

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

source§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,