Struct wasmtime_environ::prelude::IndexSet
source · pub struct IndexSet<T> { /* private fields */ }
Expand description
Implementations§
source§impl<T> IndexSet<T>
impl<T> IndexSet<T>
sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional
more elements to be inserted in the IndexSet
.
sourcepub fn contains<Q>(&self, value: &Q) -> bool
pub fn contains<Q>(&self, value: &Q) -> bool
Returns true if the IndexSet
contains an element equal to the value
.
sourcepub fn get<Q>(&self, value: &Q) -> Option<&T>
pub fn get<Q>(&self, value: &Q) -> Option<&T>
Returns a reference to the element in the IndexSet
, if any, that is equal to the value
.
sourcepub fn get_index_of<Q>(&self, value: &Q) -> Option<usize>
pub fn get_index_of<Q>(&self, value: &Q) -> Option<usize>
Return the index of the item provided, if it exists.
sourcepub fn insert(&mut self, value: T) -> bool
pub fn insert(&mut self, value: T) -> bool
Adds value
to the IndexSet
.
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.
sourcepub fn swap_remove<Q>(&mut self, value: &Q) -> bool
pub fn swap_remove<Q>(&mut self, value: &Q) -> bool
Remove the value from the IndexSet
, and return true
if it was present.
Like Vec::swap_remove
, the value is removed by swapping it with the
last element of the set and popping it off. This perturbs
the position of what used to be the last element!
Return false
if value
was not in the set.
Computes in O(1) time (average).
sourcepub fn replace(&mut self, value: T) -> Option<T>
pub fn replace(&mut self, value: T) -> Option<T>
Adds a value to the IndexSet
, replacing the existing value, if any, that is equal to the given
one. Returns the replaced value.
sourcepub fn is_disjoint(&self, other: &IndexSet<T>) -> bool
pub fn is_disjoint(&self, other: &IndexSet<T>) -> bool
Returns true
if self
has no elements in common with other
.
This is equivalent to checking for an empty intersection.
sourcepub fn is_subset(&self, other: &IndexSet<T>) -> bool
pub fn is_subset(&self, other: &IndexSet<T>) -> bool
Returns true
if the IndexSet
is a subset of another,
i.e., other
contains at least all the values in self
.
sourcepub fn is_superset(&self, other: &IndexSet<T>) -> bool
pub fn is_superset(&self, other: &IndexSet<T>) -> bool
Returns true
if the IndexSet
is a superset of another,
i.e., self
contains at least all the values in other
.
Trait Implementations§
source§impl<'a, T> Deserialize<'a> for IndexSet<T>
impl<'a, T> Deserialize<'a> for IndexSet<T>
source§fn deserialize<D>(
deserializer: D,
) -> Result<IndexSet<T>, <D as Deserializer<'a>>::Error>where
D: Deserializer<'a>,
fn deserialize<D>(
deserializer: D,
) -> Result<IndexSet<T>, <D as Deserializer<'a>>::Error>where
D: Deserializer<'a>,
source§impl<T> Extend<T> for IndexSet<T>
impl<T> Extend<T> for IndexSet<T>
source§fn extend<Iter>(&mut self, iter: Iter)where
Iter: IntoIterator<Item = T>,
fn extend<Iter>(&mut self, iter: Iter)where
Iter: IntoIterator<Item = T>,
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl<T> FromIterator<T> for IndexSet<T>
impl<T> FromIterator<T> for IndexSet<T>
source§impl<'a, T> IntoIterator for &'a IndexSet<T>
impl<'a, T> IntoIterator for &'a IndexSet<T>
source§impl<T> IntoIterator for IndexSet<T>
impl<T> IntoIterator for IndexSet<T>
source§impl<T> Serialize for IndexSet<T>
impl<T> Serialize for IndexSet<T>
source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
impl<T> Eq for IndexSet<T>
Auto Trait Implementations§
impl<T> Freeze for IndexSet<T>
impl<T> RefUnwindSafe for IndexSet<T>where
T: RefUnwindSafe,
impl<T> Send for IndexSet<T>where
T: Send,
impl<T> Sync for IndexSet<T>where
T: Sync,
impl<T> Unpin for IndexSet<T>where
T: Unpin,
impl<T> UnwindSafe for IndexSet<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.