Struct IndexSet
struct IndexSet<T, S = std::collections::hash_map::RandomState> { ... }
A hash set where the iteration order of the values is independent of their hash values.
The interface is closely compatible with the standard
[HashSet][std::collections::HashSet],
but also has additional features.
Order
The values have a consistent order that is determined by the sequence of insertion and removal calls on the set. The order does not depend on the values or the hash function at all. Note that insertion order and value are not affected if a re-insertion is attempted once an element is already present.
All iterators traverse the set in order. Set operation iterators like
IndexSet::union produce a concatenated order, as do their matching "bitwise"
operators. See their documentation for specifics.
The insertion order is preserved, with notable exceptions like the
[.remove()][Self::remove] or [.swap_remove()][Self::swap_remove] methods.
Methods such as [.sort_by()][Self::sort_by] of
course result in a new order, depending on the sorting order.
Indices
The values are indexed in a compact range without holes in the range
0..self.len(). For example, the method .get_full looks up the index for
a value, and the method .get_index looks up the value by index.
Complexity
Internally, IndexSet<T, S> just holds an IndexMap<T, (), S>. Thus the complexity
of the two are the same for most methods.
Examples
use IndexSet;
// Collects which letters appear in a sentence.
let letters: = "a short treatise on fungi".chars.collect;
assert!;
assert!;
assert!;
assert!;
Implementations
impl<T> IndexSet<T>
fn new() -> SelfCreate a new set. (Does not allocate.)
fn with_capacity(n: usize) -> SelfCreate a new set with capacity for
nelements. (Does not allocate ifnis zero.)Computes in O(n) time.
impl<T, S> IndexSet<T, S>
fn pop(self: &mut Self) -> Option<T>Remove the last value
This preserves the order of the remaining elements.
Computes in O(1) time (average).
fn retain<F>(self: &mut Self, keep: F) where F: FnMut(&T) -> boolScan through each value in the set and keep those where the closure
keepreturnstrue.The elements are visited in order, and remaining elements keep their order.
Computes in O(n) time (average).
fn sort(self: &mut Self) where T: OrdSort the set’s values by their default ordering.
This is a stable sort -- but equivalent values should not normally coexist in a set at all, so [
sort_unstable][Self::sort_unstable] is preferred because it is generally faster and doesn't allocate auxiliary memory.See
sort_byfor details.fn sort_by<F>(self: &mut Self, cmp: F) where F: FnMut(&T, &T) -> OrderingSort the set’s values in place using the comparison function
cmp.Computes in O(n log n) time and O(n) space. The sort is stable.
fn sorted_by<F>(self: Self, cmp: F) -> IntoIter<T> where F: FnMut(&T, &T) -> OrderingSort the values of the set and return a by-value iterator of the values with the result.
The sort is stable.
fn sort_unstable(self: &mut Self) where T: OrdSort the set's values by their default ordering.
See
sort_unstable_byfor details.fn sort_unstable_by<F>(self: &mut Self, cmp: F) where F: FnMut(&T, &T) -> OrderingSort the set's values in place using the comparison function
cmp.Computes in O(n log n) time. The sort is unstable.
fn sorted_unstable_by<F>(self: Self, cmp: F) -> IntoIter<T> where F: FnMut(&T, &T) -> OrderingSort the values of the set and return a by-value iterator of the values with the result.
fn sort_by_cached_key<K, F>(self: &mut Self, sort_key: F) where K: Ord, F: FnMut(&T) -> KSort the set’s values in place using a key extraction function.
During sorting, the function is called at most once per entry, by using temporary storage to remember the results of its evaluation. The order of calls to the function is unspecified and may change between versions of
indexmapor the standard library.Computes in O(m n + n log n + c) time () and O(n) space, where the function is O(m), n is the length of the map, and c the capacity. The sort is stable.
fn binary_search(self: &Self, x: &T) -> Result<usize, usize> where T: OrdSearch over a sorted set for a value.
Returns the position where that value is present, or the position where it can be inserted to maintain the sort. See
slice::binary_searchfor more details.Computes in O(log(n)) time, which is notably less scalable than looking the value up using [
get_index_of][IndexSet::get_index_of], but this can also position missing values.fn binary_search_by<'a, F>(self: &'a Self, f: F) -> Result<usize, usize> where F: FnMut(&'a T) -> OrderingSearch over a sorted set with a comparator function.
Returns the position where that value is present, or the position where it can be inserted to maintain the sort. See
slice::binary_search_byfor more details.Computes in O(log(n)) time.
fn binary_search_by_key<'a, B, F>(self: &'a Self, b: &B, f: F) -> Result<usize, usize> where F: FnMut(&'a T) -> B, B: OrdSearch over a sorted set with an extraction function.
Returns the position where that value is present, or the position where it can be inserted to maintain the sort. See
slice::binary_search_by_keyfor more details.Computes in O(log(n)) time.
fn partition_point<P>(self: &Self, pred: P) -> usize where P: FnMut(&T) -> boolReturns the index of the partition point of a sorted set according to the given predicate (the index of the first element of the second partition).
See
slice::partition_pointfor more details.Computes in O(log(n)) time.
fn reverse(self: &mut Self)Reverses the order of the set’s values in place.
Computes in O(n) time and O(1) space.
fn as_slice(self: &Self) -> &Slice<T>Returns a slice of all the values in the set.
Computes in O(1) time.
fn into_boxed_slice(self: Self) -> Box<Slice<T>>Converts into a boxed slice of all the values in the set.
Note that this will drop the inner hash table and any excess capacity.
fn get_index(self: &Self, index: usize) -> Option<&T>Get a value by index
Valid indices are
0 <= index < self.len().Computes in O(1) time.
fn get_range<R: RangeBounds<usize>>(self: &Self, range: R) -> Option<&Slice<T>>Returns a slice of values in the given range of indices.
Valid indices are
0 <= index < self.len().Computes in O(1) time.
fn first(self: &Self) -> Option<&T>Get the first value
Computes in O(1) time.
fn last(self: &Self) -> Option<&T>Get the last value
Computes in O(1) time.
fn swap_remove_index(self: &mut Self, index: usize) -> Option<T>Remove the value by index
Valid indices are
0 <= index < self.len().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!Computes in O(1) time (average).
fn shift_remove_index(self: &mut Self, index: usize) -> Option<T>Remove the value by index
Valid indices are
0 <= index < self.len().Like
Vec::remove, the value is removed by shifting all of the elements that follow it, preserving their relative order. This perturbs the index of all of those elements!Computes in O(n) time (average).
fn move_index(self: &mut Self, from: usize, to: usize)Moves the position of a value from one index to another by shifting all other values in-between.
- If
from < to, the other values will shift down while the targeted value moves up. - If
from > to, the other values will shift up while the targeted value moves down.
Panics if
fromortoare out of bounds.Computes in O(n) time (average).
- If
fn swap_indices(self: &mut Self, a: usize, b: usize)Swaps the position of two values in the set.
Panics if
aorbare out of bounds.Computes in O(1) time (average).
impl<T, S> IndexSet<T, S>
fn with_capacity_and_hasher(n: usize, hash_builder: S) -> SelfCreate a new set with capacity for
nelements. (Does not allocate ifnis zero.)Computes in O(n) time.
const fn with_hasher(hash_builder: S) -> SelfCreate a new set with
hash_builder.This function is
const, so it can be called instaticcontexts.fn capacity(self: &Self) -> usizeReturn the number of elements the set can hold without reallocating.
This number is a lower bound; the set might be able to hold more, but is guaranteed to be able to hold at least this many.
Computes in O(1) time.
fn hasher(self: &Self) -> &SReturn a reference to the set's
BuildHasher.fn len(self: &Self) -> usizeReturn the number of elements in the set.
Computes in O(1) time.
fn is_empty(self: &Self) -> boolReturns true if the set contains no elements.
Computes in O(1) time.
fn iter(self: &Self) -> Iter<'_, T>Return an iterator over the values of the set, in their order
fn clear(self: &mut Self)Remove all elements in the set, while preserving its capacity.
Computes in O(n) time.
fn truncate(self: &mut Self, len: usize)Shortens the set, keeping the first
lenelements and dropping the rest.If
lenis greater than the set's current length, this has no effect.fn drain<R>(self: &mut Self, range: R) -> Drain<'_, T> where R: RangeBounds<usize>Clears the
IndexSetin the given index range, returning those values as a drain iterator.The range may be any type that implements [
RangeBounds<usize>], including all of thestd::ops::Range*types, or even a tuple pair ofBoundstart and end values. To drain the set entirely, useRangeFulllikeset.drain(..).This shifts down all entries following the drained range to fill the gap, and keeps the allocated memory for reuse.
Panics if the starting point is greater than the end point or if the end point is greater than the length of the set.
fn extract_if<F, R>(self: &mut Self, range: R, pred: F) -> ExtractIf<'_, T, F> where F: FnMut(&T) -> bool, R: RangeBounds<usize>Creates an iterator which uses a closure to determine if a value should be removed, for all values in the given range.
If the closure returns true, then the value is removed and yielded. If the closure returns false, the value will remain in the list and will not be yielded by the iterator.
The range may be any type that implements [
RangeBounds<usize>], including all of thestd::ops::Range*types, or even a tuple pair ofBoundstart and end values. To check the entire set, useRangeFulllikeset.extract_if(.., predicate).If the returned
ExtractIfis not exhausted, e.g. because it is dropped without iterating or the iteration short-circuits, then the remaining elements will be retained. Useretainwith a negated predicate if you do not need the returned iterator.Panics if the starting point is greater than the end point or if the end point is greater than the length of the set.
Examples
Splitting a set into even and odd values, reusing the original set:
use IndexSet; let mut set: = .collect; let extracted: = set.extract_if.collect; let evens = extracted.into_iter.; let odds = set.into_iter.; assert_eq!; assert_eq!;fn split_off(self: &mut Self, at: usize) -> Self where S: CloneSplits the collection into two at the given index.
Returns a newly allocated set containing the elements in the range
[at, len). After the call, the original set will be left containing the elements[0, at)with its previous capacity unchanged.Panics if
at > len.fn reserve(self: &mut Self, additional: usize)Reserve capacity for
additionalmore values.Computes in O(n) time.
fn reserve_exact(self: &mut Self, additional: usize)Reserve capacity for
additionalmore values, without over-allocating.Unlike
reserve, this does not deliberately over-allocate the entry capacity to avoid frequent re-allocations. However, the underlying data structures may still have internal capacity requirements, and the allocator itself may give more space than requested, so this cannot be relied upon to be precisely minimal.Computes in O(n) time.
fn try_reserve(self: &mut Self, additional: usize) -> Result<(), TryReserveError>Try to reserve capacity for
additionalmore values.Computes in O(n) time.
fn try_reserve_exact(self: &mut Self, additional: usize) -> Result<(), TryReserveError>Try to reserve capacity for
additionalmore values, without over-allocating.Unlike
try_reserve, this does not deliberately over-allocate the entry capacity to avoid frequent re-allocations. However, the underlying data structures may still have internal capacity requirements, and the allocator itself may give more space than requested, so this cannot be relied upon to be precisely minimal.Computes in O(n) time.
fn shrink_to_fit(self: &mut Self)Shrink the capacity of the set as much as possible.
Computes in O(n) time.
fn shrink_to(self: &mut Self, min_capacity: usize)Shrink the capacity of the set with a lower limit.
Computes in O(n) time.
impl<T, S> IndexSet<T, S>
fn insert(self: &mut Self, value: T) -> boolInsert the value into the set.
If an equivalent item already exists in the set, it returns
falseleaving the original value in the set and without altering its insertion order. Otherwise, it inserts the new item and returnstrue.Computes in O(1) time (amortized average).
fn insert_full(self: &mut Self, value: T) -> (usize, bool)Insert the value into the set, and get its index.
If an equivalent item already exists in the set, it returns the index of the existing item and
false, leaving the original value in the set and without altering its insertion order. Otherwise, it inserts the new item and returns the index of the inserted item andtrue.Computes in O(1) time (amortized average).
fn insert_sorted(self: &mut Self, value: T) -> (usize, bool) where T: OrdInsert the value into the set at its ordered position among sorted values.
This is equivalent to finding the position with [
binary_search][Self::binary_search], and if needed calling [insert_before][Self::insert_before] for a new value.If the sorted item is found in the set, it returns the index of that existing item and
false, without any change. Otherwise, it inserts the new item and returns its sorted index andtrue.If the existing items are not already sorted, then the insertion index is unspecified (like
slice::binary_search), but the value is moved to or inserted at that position regardless.Computes in O(n) time (average). Instead of repeating calls to
insert_sorted, it may be faster to call batched [insert][Self::insert] or [extend][Self::extend] and only call [sort][Self::sort] or [sort_unstable][Self::sort_unstable] once.fn insert_before(self: &mut Self, index: usize, value: T) -> (usize, bool)Insert the value into the set before the value at the given index, or at the end.
If an equivalent item already exists in the set, it returns
falseleaving the original value in the set, but moved to the new position. The returned index will either be the given index or one less, depending on how the value moved. (Seeshift_insertfor different behavior here.)Otherwise, it inserts the new value exactly at the given index and returns
true.Panics if
indexis out of bounds. Valid indices are0..=set.len()(inclusive).Computes in O(n) time (average).
Examples
use IndexSet; let mut set: = .collect; // The new value '*' goes exactly at the given index. assert_eq!; assert_eq!; assert_eq!; // Moving the value 'a' up will shift others down, so this moves *before* 10 to index 9. assert_eq!; assert_eq!; assert_eq!; // Moving the value 'z' down will shift others up, so this moves to exactly 10. assert_eq!; assert_eq!; assert_eq!; // Moving or inserting before the endpoint is also valid. assert_eq!; assert_eq!; assert_eq!; assert_eq!; assert_eq!; assert_eq!;fn shift_insert(self: &mut Self, index: usize, value: T) -> boolInsert the value into the set at the given index.
If an equivalent item already exists in the set, it returns
falseleaving the original value in the set, but moved to the given index. Note that existing values cannot be moved toindex == set.len()! (Seeinsert_beforefor different behavior here.)Otherwise, it inserts the new value at the given index and returns
true.Panics if
indexis out of bounds. Valid indices are0..set.len()(exclusive) when moving an existing value, or0..=set.len()(inclusive) when inserting a new value.Computes in O(n) time (average).
Examples
use IndexSet; let mut set: = .collect; // The new value '*' goes exactly at the given index. assert_eq!; assert_eq!; assert_eq!; // Moving the value 'a' up to 10 will shift others down, including the '*' that was at 10. assert_eq!; assert_eq!; assert_eq!; // Moving the value 'z' down to 9 will shift others up, including the '*' that was at 9. assert_eq!; assert_eq!; assert_eq!; // Existing values can move to len-1 at most, but new values can insert at the endpoint. assert_eq!; assert_eq!; assert_eq!; assert_eq!; assert_eq!; assert_eq!;use indexmap::IndexSet; let mut set: IndexSet<char> = ('a'..='z').collect(); // This is an invalid index for moving an existing value! set.shift_insert(set.len(), 'a');fn replace(self: &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, without altering its insertion order. Returns the replaced value.
Computes in O(1) time (average).
fn replace_full(self: &mut Self, value: T) -> (usize, Option<T>)Adds a value to the set, replacing the existing value, if any, that is equal to the given one, without altering its insertion order. Returns the index of the item and its replaced value.
Computes in O(1) time (average).
fn difference<'a, S2>(self: &'a Self, other: &'a IndexSet<T, S2>) -> Difference<'a, T, S2> where S2: BuildHasherReturn an iterator over the values that are in
selfbut notother.Values are produced in the same order that they appear in
self.fn symmetric_difference<'a, S2>(self: &'a Self, other: &'a IndexSet<T, S2>) -> SymmetricDifference<'a, T, S, S2> where S2: BuildHasherReturn an iterator over the values that are in
selforother, but not in both.Values from
selfare produced in their original order, followed by values fromotherin their original order.fn intersection<'a, S2>(self: &'a Self, other: &'a IndexSet<T, S2>) -> Intersection<'a, T, S2> where S2: BuildHasherReturn an iterator over the values that are in both
selfandother.Values are produced in the same order that they appear in
self.fn union<'a, S2>(self: &'a Self, other: &'a IndexSet<T, S2>) -> Union<'a, T, S> where S2: BuildHasherReturn an iterator over all values that are in
selforother.Values from
selfare produced in their original order, followed by values that are unique tootherin their original order.fn splice<R, I>(self: &mut Self, range: R, replace_with: I) -> Splice<'_, <I as >::IntoIter, T, S> where R: RangeBounds<usize>, I: IntoIterator<Item = T>Creates a splicing iterator that replaces the specified range in the set with the given
replace_withiterator and yields the removed items.replace_withdoes not need to be the same length asrange.The
rangeis removed even if the iterator is not consumed until the end. It is unspecified how many elements are removed from the set if theSplicevalue is leaked.The input iterator
replace_withis only consumed when theSplicevalue is dropped. If a value from the iterator matches an existing entry in the set (outside ofrange), then the original will be unchanged. Otherwise, the new value will be inserted in the replacedrange.Panics if the starting point is greater than the end point or if the end point is greater than the length of the set.
Examples
use IndexSet; let mut set = from; let new = ; let removed: = set.splice.collect; // 1 and 4 kept their positions, while 5, 3, and 2 were newly inserted. assert!; assert_eq!;fn append<S2>(self: &mut Self, other: &mut IndexSet<T, S2>)Moves all values from
otherintoself, leavingotherempty.This is equivalent to calling [
insert][Self::insert] for each value fromotherin order, which means that values that already exist inselfare unchanged in their current position.See also [
union][Self::union] to iterate the combined values by reference, without modifyingselforother.Examples
use IndexSet; let mut a = from; let mut b = from; let old_capacity = b.capacity; a.append; assert_eq!; assert_eq!; assert_eq!; assert!;
impl<T, S> IndexSet<T, S>
fn contains<Q>(self: &Self, value: &Q) -> bool where Q: ?Sized + Hash + Equivalent<T>Return
trueif an equivalent tovalueexists in the set.Computes in O(1) time (average).
fn get<Q>(self: &Self, value: &Q) -> Option<&T> where Q: ?Sized + Hash + Equivalent<T>Return a reference to the value stored in the set, if it is present, else
None.Computes in O(1) time (average).
fn get_full<Q>(self: &Self, value: &Q) -> Option<(usize, &T)> where Q: ?Sized + Hash + Equivalent<T>Return item index and value
fn get_index_of<Q>(self: &Self, value: &Q) -> Option<usize> where Q: ?Sized + Hash + Equivalent<T>Return item index, if it exists in the set
Computes in O(1) time (average).
fn remove<Q>(self: &mut Self, value: &Q) -> bool where Q: ?Sized + Hash + Equivalent<T>Remove the value from the set, and return
trueif it was present.NOTE: This is equivalent to [
.swap_remove(value)][Self::swap_remove], replacing this value's position with the last element, and it is deprecated in favor of calling that explicitly. If you need to preserve the relative order of the values in the set, use [.shift_remove(value)][Self::shift_remove] instead.fn swap_remove<Q>(self: &mut Self, value: &Q) -> bool where Q: ?Sized + Hash + Equivalent<T>Remove the value from the set, and return
trueif 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
falseifvaluewas not in the set.Computes in O(1) time (average).
fn shift_remove<Q>(self: &mut Self, value: &Q) -> bool where Q: ?Sized + Hash + Equivalent<T>Remove the value from the set, and return
trueif it was present.Like
Vec::remove, the value is removed by shifting all of the elements that follow it, preserving their relative order. This perturbs the index of all of those elements!Return
falseifvaluewas not in the set.Computes in O(n) time (average).
fn take<Q>(self: &mut Self, value: &Q) -> Option<T> where Q: ?Sized + Hash + Equivalent<T>Removes and returns the value in the set, if any, that is equal to the given one.
NOTE: This is equivalent to [
.swap_take(value)][Self::swap_take], replacing this value's position with the last element, and it is deprecated in favor of calling that explicitly. If you need to preserve the relative order of the values in the set, use [.shift_take(value)][Self::shift_take] instead.fn swap_take<Q>(self: &mut Self, value: &Q) -> Option<T> where Q: ?Sized + Hash + Equivalent<T>Removes and returns the value in the set, if any, that is equal to the given one.
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
Noneifvaluewas not in the set.Computes in O(1) time (average).
fn shift_take<Q>(self: &mut Self, value: &Q) -> Option<T> where Q: ?Sized + Hash + Equivalent<T>Removes and returns the value in the set, if any, that is equal to the given one.
Like
Vec::remove, the value is removed by shifting all of the elements that follow it, preserving their relative order. This perturbs the index of all of those elements!Return
Noneifvaluewas not in the set.Computes in O(n) time (average).
fn swap_remove_full<Q>(self: &mut Self, value: &Q) -> Option<(usize, T)> where Q: ?Sized + Hash + Equivalent<T>Remove the value from the set return it and the index it had.
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
Noneifvaluewas not in the set.fn shift_remove_full<Q>(self: &mut Self, value: &Q) -> Option<(usize, T)> where Q: ?Sized + Hash + Equivalent<T>Remove the value from the set return it and the index it had.
Like
Vec::remove, the value is removed by shifting all of the elements that follow it, preserving their relative order. This perturbs the index of all of those elements!Return
Noneifvaluewas not in the set.
impl<T, S> IndexSet<T, S>
fn is_disjoint<S2>(self: &Self, other: &IndexSet<T, S2>) -> bool where S2: BuildHasherReturns
trueifselfhas no elements in common withother.fn is_subset<S2>(self: &Self, other: &IndexSet<T, S2>) -> bool where S2: BuildHasherReturns
trueif all elements ofselfare contained inother.fn is_superset<S2>(self: &Self, other: &IndexSet<T, S2>) -> bool where S2: BuildHasherReturns
trueif all elements ofotherare contained inself.
impl<'a, T, S> Extend for IndexSet<T, S>
fn extend<I: IntoIterator<Item = &'a T>>(self: &mut Self, iterable: I)
impl<Q, K> Equivalent for IndexSet<T, S>
fn equivalent(self: &Self, key: &K) -> bool
impl<Q, K> Equivalent for IndexSet<T, S>
fn equivalent(self: &Self, key: &K) -> bool
impl<T> Any for IndexSet<T, S>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for IndexSet<T, S>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for IndexSet<T, S>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for IndexSet<T, S>
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for IndexSet<T, S>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for IndexSet<T, S>
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, N: usize> From for IndexSet<T, RandomState>
fn from(arr: [T; N]) -> SelfExamples
use IndexSet; let set1 = from; let set2: = .into; assert_eq!;
impl<T, S> Clone for IndexSet<T, S>
fn clone(self: &Self) -> Selffn clone_from(self: &mut Self, other: &Self)
impl<T, S> Debug for IndexSet<T, S>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<T, S> Default for IndexSet<T, S>
fn default() -> SelfReturn an empty
IndexSet
impl<T, S> Eq for IndexSet<T, S>
impl<T, S> Extend for IndexSet<T, S>
fn extend<I: IntoIterator<Item = T>>(self: &mut Self, iterable: I)
impl<T, S> Freeze for IndexSet<T, S>
impl<T, S> FromIterator for IndexSet<T, S>
fn from_iter<I: IntoIterator<Item = T>>(iterable: I) -> Self
impl<T, S> Index for IndexSet<T, S>
fn index(self: &Self, range: RangeFull) -> &<Self as >::Output
impl<T, S> Index for IndexSet<T, S>
fn index(self: &Self, range: (Bound<usize>, Bound<usize>)) -> &<Self as >::Output
impl<T, S> Index for IndexSet<T, S>
fn index(self: &Self, range: RangeInclusive<usize>) -> &<Self as >::Output
impl<T, S> Index for IndexSet<T, S>
fn index(self: &Self, index: usize) -> &TReturns a reference to the value at the supplied
index.Panics if
indexis out of bounds.
impl<T, S> Index for IndexSet<T, S>
fn index(self: &Self, range: Range<usize>) -> &<Self as >::Output
impl<T, S> Index for IndexSet<T, S>
fn index(self: &Self, range: RangeTo<usize>) -> &<Self as >::Output
impl<T, S> Index for IndexSet<T, S>
fn index(self: &Self, range: RangeFrom<usize>) -> &<Self as >::Output
impl<T, S> Index for IndexSet<T, S>
fn index(self: &Self, range: RangeToInclusive<usize>) -> &<Self as >::Output
impl<T, S> IntoIterator for IndexSet<T, S>
fn into_iter(self: Self) -> <Self as >::IntoIter
impl<T, S> MutableValues for IndexSet<T, S>
fn get_full_mut2<Q>(self: &mut Self, value: &Q) -> Option<(usize, &mut T)> where Q: ?Sized + Hash + Equivalent<T>fn get_index_mut2(self: &mut Self, index: usize) -> Option<&mut T>fn retain2<F>(self: &mut Self, keep: F) where F: FnMut(&mut T) -> bool
impl<T, S> RefUnwindSafe for IndexSet<T, S>
impl<T, S> Send for IndexSet<T, S>
impl<T, S> Sync for IndexSet<T, S>
impl<T, S> Unpin for IndexSet<T, S>
impl<T, S> UnsafeUnpin for IndexSet<T, S>
impl<T, S> UnwindSafe for IndexSet<T, S>
impl<T, S1, S2> PartialEq for IndexSet<T, S1>
fn eq(self: &Self, other: &IndexSet<T, S2>) -> bool
impl<T, U> Into for IndexSet<T, S>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for IndexSet<T, S>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for IndexSet<T, S>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>