pub struct IndexSet<T, S = RandomState> {
    pub(crate) map: IndexMap<T, (), S>,
}
Expand description

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, 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 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() or .swap_remove() methods. Methods such as .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.

§Examples

use indexmap::IndexSet;

// Collects which letters appear in a sentence.
let letters: IndexSet<_> = "a short treatise on fungi".chars().collect();

assert!(letters.contains(&'s'));
assert!(letters.contains(&'t'));
assert!(letters.contains(&'u'));
assert!(!letters.contains(&'y'));

Fields§

§map: IndexMap<T, (), S>

Implementations§

source§

impl<T> IndexSet<T>

source

pub fn new() -> IndexSet<T>

Create a new set. (Does not allocate.)

source

pub fn with_capacity(n: usize) -> IndexSet<T>

Create a new set with capacity for n elements. (Does not allocate if n is zero.)

Computes in O(n) time.

source§

impl<T, S> IndexSet<T, S>

source

pub fn with_capacity_and_hasher(n: usize, hash_builder: S) -> IndexSet<T, S>

Create a new set with capacity for n elements. (Does not allocate if n is zero.)

Computes in O(n) time.

source

pub const fn with_hasher(hash_builder: S) -> IndexSet<T, S>

Create a new set with hash_builder.

This function is const, so it can be called in static contexts.

source

pub fn capacity(&self) -> usize

Computes in O(1) time.

source

pub fn hasher(&self) -> &S

Return a reference to the set’s BuildHasher.

source

pub fn len(&self) -> usize

Return the number of elements in the set.

Computes in O(1) time.

source

pub fn is_empty(&self) -> bool

Returns true if the set contains no elements.

Computes in O(1) time.

source

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

Return an iterator over the values of the set, in their order

source

pub fn clear(&mut self)

Remove all elements in the set, while preserving its capacity.

Computes in O(n) time.

source

pub fn truncate(&mut self, len: usize)

Shortens the set, keeping the first len elements and dropping the rest.

If len is greater than the set’s current length, this has no effect.

source

pub fn drain<R>(&mut self, range: R) -> Drain<'_, T>
where R: RangeBounds<usize>,

Clears the IndexSet in the given index range, returning those values as a drain iterator.

The range may be any type that implements RangeBounds<usize>, including all of the std::ops::Range* types, or even a tuple pair of Bound start and end values. To drain the set entirely, use RangeFull like set.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.

source

pub fn split_off(&mut self, at: usize) -> IndexSet<T, S>
where S: Clone,

Splits 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.

source§

impl<T, S> IndexSet<T, S>
where T: Hash + Eq, S: BuildHasher,

source

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

Reserve capacity for additional more values.

Computes in O(n) time.

source

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

Reserve capacity for additional more 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.

source

pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>

Try to reserve capacity for additional more values.

Computes in O(n) time.

source

pub fn try_reserve_exact( &mut self, additional: usize ) -> Result<(), TryReserveError>

Try to reserve capacity for additional more 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.

source

pub fn shrink_to_fit(&mut self)

Shrink the capacity of the set as much as possible.

Computes in O(n) time.

source

pub fn shrink_to(&mut self, min_capacity: usize)

Shrink the capacity of the set with a lower limit.

Computes in O(n) time.

source

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

Insert the value into the set.

If an equivalent item already exists in the set, it returns false leaving the original value in the set and without altering its insertion order. Otherwise, it inserts the new item and returns true.

Computes in O(1) time (amortized average).

source

pub fn insert_full(&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 and true.

Computes in O(1) time (amortized average).

source

pub fn difference<S2, 'a>( &'a self, other: &'a IndexSet<T, S2> ) -> Difference<'a, T, S2>
where S2: BuildHasher,

Return an iterator over the values that are in self but not other.

Values are produced in the same order that they appear in self.

source

pub fn symmetric_difference<S2, 'a>( &'a self, other: &'a IndexSet<T, S2> ) -> SymmetricDifference<'a, T, S, S2>
where S2: BuildHasher,

Return an iterator over the values that are in self or other, but not in both.

Values from self are produced in their original order, followed by values from other in their original order.

source

pub fn intersection<S2, 'a>( &'a self, other: &'a IndexSet<T, S2> ) -> Intersection<'a, T, S2>
where S2: BuildHasher,

Return an iterator over the values that are in both self and other.

Values are produced in the same order that they appear in self.

source

pub fn union<S2, 'a>(&'a self, other: &'a IndexSet<T, S2>) -> Union<'a, T, S>
where S2: BuildHasher,

Return an iterator over all values that are in self or other.

Values from self are produced in their original order, followed by values that are unique to other in their original order.

source

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

Return true if an equivalent to value exists in the set.

Computes in O(1) time (average).

source

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

Return a reference to the value stored in the set, if it is present, else None.

Computes in O(1) time (average).

source

pub fn get_full<Q>(&self, value: &Q) -> Option<(usize, &T)>
where Q: Hash + Equivalent<T> + ?Sized,

Return item index and value

source

pub fn get_index_of<Q>(&self, value: &Q) -> Option<usize>
where Q: Hash + Equivalent<T> + ?Sized,

Return item index, if it exists in the set

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, without altering its insertion order. Returns the replaced value.

Computes in O(1) time (average).

source

pub fn replace_full(&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).

source

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

Remove the value from the set, and return true if it was present.

NOTE: This is equivalent to .swap_remove(value), if you want to preserve the order of the values in the set, use .shift_remove(value).

Computes in O(1) time (average).

source

pub fn swap_remove<Q>(&mut self, value: &Q) -> bool
where Q: Hash + Equivalent<T> + ?Sized,

Remove the value from the set, 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).

source

pub fn shift_remove<Q>(&mut self, value: &Q) -> bool
where Q: Hash + Equivalent<T> + ?Sized,

Remove the value from the set, and return true if 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 false if value was not in the set.

Computes in O(n) time (average).

source

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

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), if you need to preserve the order of the values in the set, use .shift_take(value) instead.

Computes in O(1) time (average).

source

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

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 None if value was not in the set.

Computes in O(1) time (average).

source

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

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 None if value was not in the set.

Computes in O(n) time (average).

source

pub fn swap_remove_full<Q>(&mut self, value: &Q) -> Option<(usize, T)>
where Q: Hash + Equivalent<T> + ?Sized,

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 None if value was not in the set.

source

pub fn shift_remove_full<Q>(&mut self, value: &Q) -> Option<(usize, T)>
where Q: Hash + Equivalent<T> + ?Sized,

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 None if value was not in the set.

source

pub fn pop(&mut self) -> Option<T>

Remove the last value

This preserves the order of the remaining elements.

Computes in O(1) time (average).

source

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

Scan through each value in the set and keep those where the closure keep returns true.

The elements are visited in order, and remaining elements keep their order.

Computes in O(n) time (average).

source

pub fn sort(&mut self)
where T: Ord,

Sort the set’s values by their default ordering.

See sort_by for details.

source

pub fn sort_by<F>(&mut self, cmp: F)
where F: FnMut(&T, &T) -> Ordering,

Sort 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.

source

pub fn sorted_by<F>(self, cmp: F) -> IntoIter<T>
where F: FnMut(&T, &T) -> Ordering,

Sort the values of the set and return a by-value iterator of the values with the result.

The sort is stable.

source

pub fn sort_unstable(&mut self)
where T: Ord,

Sort the set’s values by their default ordering.

See sort_unstable_by for details.

source

pub fn sort_unstable_by<F>(&mut self, cmp: F)
where F: FnMut(&T, &T) -> Ordering,

Sort the set’s values in place using the comparison funtion cmp.

Computes in O(n log n) time. The sort is unstable.

source

pub fn sorted_unstable_by<F>(self, cmp: F) -> IntoIter<T>
where F: FnMut(&T, &T) -> Ordering,

Sort the values of the set and return a by-value iterator of the values with the result.

source

pub fn sort_by_cached_key<K, F>(&mut self, sort_key: F)
where K: Ord, F: FnMut(&T) -> K,

Sort 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 indexmap or 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.

source

pub fn reverse(&mut self)

Reverses the order of the set’s values in place.

Computes in O(n) time and O(1) space.

source§

impl<T, S> IndexSet<T, S>

source

pub fn as_slice(&self) -> &Slice<T>

Returns a slice of all the values in the set.

Computes in O(1) time.

source

pub fn into_boxed_slice(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.

source

pub fn get_index(&self, index: usize) -> Option<&T>

Get a value by index

Valid indices are 0 <= index < self.len()

Computes in O(1) time.

source

pub fn get_range<R>(&self, range: R) -> Option<&Slice<T>>
where R: RangeBounds<usize>,

Returns a slice of values in the given range of indices.

Valid indices are 0 <= index < self.len()

Computes in O(1) time.

source

pub fn first(&self) -> Option<&T>

Get the first value

Computes in O(1) time.

source

pub fn last(&self) -> Option<&T>

Get the last value

Computes in O(1) time.

source

pub fn swap_remove_index(&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).

source

pub fn shift_remove_index(&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).

source

pub fn move_index(&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 from or to are out of bounds.

Computes in O(n) time (average).

source

pub fn swap_indices(&mut self, a: usize, b: usize)

Swaps the position of two values in the set.

Panics if a or b are out of bounds.

source§

impl<T, S> IndexSet<T, S>
where T: Eq + Hash, S: BuildHasher,

source

pub fn is_disjoint<S2>(&self, other: &IndexSet<T, S2>) -> bool
where S2: BuildHasher,

Returns true if self has no elements in common with other.

source

pub fn is_subset<S2>(&self, other: &IndexSet<T, S2>) -> bool
where S2: BuildHasher,

Returns true if all elements of self are contained in other.

source

pub fn is_superset<S2>(&self, other: &IndexSet<T, S2>) -> bool
where S2: BuildHasher,

Returns true if all elements of other are contained in self.

Trait Implementations§

source§

impl<T, S1, S2> BitAnd<&IndexSet<T, S2>> for &IndexSet<T, S1>
where T: Eq + Hash + Clone, S1: BuildHasher + Default, S2: BuildHasher,

source§

fn bitand( self, other: &IndexSet<T, S2> ) -> <&IndexSet<T, S1> as BitAnd<&IndexSet<T, S2>>>::Output

Returns the set intersection, cloned into a new set.

Values are collected in the same order that they appear in self.

§

type Output = IndexSet<T, S1>

The resulting type after applying the & operator.
source§

impl<T, S1, S2> BitOr<&IndexSet<T, S2>> for &IndexSet<T, S1>
where T: Eq + Hash + Clone, S1: BuildHasher + Default, S2: BuildHasher,

source§

fn bitor( self, other: &IndexSet<T, S2> ) -> <&IndexSet<T, S1> as BitOr<&IndexSet<T, S2>>>::Output

Returns the set union, cloned into a new set.

Values from self are collected in their original order, followed by values that are unique to other in their original order.

§

type Output = IndexSet<T, S1>

The resulting type after applying the | operator.
source§

impl<T, S1, S2> BitXor<&IndexSet<T, S2>> for &IndexSet<T, S1>
where T: Eq + Hash + Clone, S1: BuildHasher + Default, S2: BuildHasher,

source§

fn bitxor( self, other: &IndexSet<T, S2> ) -> <&IndexSet<T, S1> as BitXor<&IndexSet<T, S2>>>::Output

Returns the set symmetric-difference, cloned into a new set.

Values from self are collected in their original order, followed by values from other in their original order.

§

type Output = IndexSet<T, S1>

The resulting type after applying the ^ operator.
source§

impl<X, T> Categorize<X> for IndexSet<T>
where X: CustomValueKind,

source§

impl<T, S> Clone for IndexSet<T, S>
where T: Clone, S: Clone,

source§

fn clone(&self) -> IndexSet<T, S>

Returns a copy of the value. Read more
source§

fn clone_from(&mut self, other: &IndexSet<T, S>)

Performs copy-assignment from source. Read more
source§

impl<T, S> Debug for IndexSet<T, S>
where T: Debug,

source§

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

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

impl<X, D, T> Decode<X, D> for IndexSet<T>
where X: CustomValueKind, D: Decoder<X>, T: Decode<X, D> + Categorize<X> + Hash + Eq,

source§

fn decode_body_with_value_kind( decoder: &mut D, value_kind: ValueKind<X> ) -> Result<IndexSet<T>, DecodeError>

Decodes the type from the decoder, which should match a preloaded value kind. Read more
source§

impl<T, S> Default for IndexSet<T, S>
where S: Default,

source§

fn default() -> IndexSet<T, S>

Return an empty IndexSet

source§

impl<C, T> Describe<C> for IndexSet<T>

source§

const TYPE_ID: RustTypeId = BTreeSet<T>::TYPE_ID

The TYPE_ID should give a unique identifier for its SBOR schema type. An SBOR schema type capture details about the SBOR payload, how it should be interpreted, validated and displayed. Read more
source§

fn type_data() -> TypeData<C, RustTypeId>

Returns the local schema for the given type. Read more
source§

fn add_all_dependencies(aggregator: &mut TypeAggregator<C>)

For each type referenced in get_local_type_data, we need to ensure that the type and all of its own references get added to the aggregator. Read more
source§

impl<'de, T, S> Deserialize<'de> for IndexSet<T, S>
where T: Deserialize<'de> + Eq + Hash, S: Default + BuildHasher,

Requires crate feature "serde"

source§

fn deserialize<D>( deserializer: D ) -> Result<IndexSet<T, S>, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

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

impl<X, E, T> Encode<X, E> for IndexSet<T>
where X: CustomValueKind, E: Encoder<X>, T: Encode<X, E> + Categorize<X> + Hash,

source§

fn encode_value_kind(&self, encoder: &mut E) -> Result<(), EncodeError>

Encodes the SBOR value’s kind to the encoder
source§

fn encode_body(&self, encoder: &mut E) -> Result<(), EncodeError>

Encodes the SBOR body of the type to the encoder. Read more
source§

impl<'a, T, S> Extend<&'a T> for IndexSet<T, S>
where T: Hash + Eq + Copy + 'a, S: BuildHasher,

source§

fn extend<I>(&mut self, iterable: I)
where I: 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, S> Extend<T> for IndexSet<T, S>
where T: Hash + Eq, S: BuildHasher,

source§

fn extend<I>(&mut self, iterable: I)
where I: 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, const N: usize> From<[T; N]> for IndexSet<T>
where T: Eq + Hash,

source§

fn from(arr: [T; N]) -> IndexSet<T>

§Examples
use indexmap::IndexSet;

let set1 = IndexSet::from([1, 2, 3, 4]);
let set2: IndexSet<_> = [1, 2, 3, 4].into();
assert_eq!(set1, set2);
source§

impl<T, S> FromIterator<T> for IndexSet<T, S>
where T: Hash + Eq, S: BuildHasher + Default,

source§

fn from_iter<I>(iterable: I) -> IndexSet<T, S>
where I: IntoIterator<Item = T>,

Creates a value from an iterator. Read more
source§

impl<T, S> Index<(Bound<usize>, Bound<usize>)> for IndexSet<T, S>

§

type Output = Slice<T>

The returned type after indexing.
source§

fn index( &self, range: (Bound<usize>, Bound<usize>) ) -> &<IndexSet<T, S> as Index<(Bound<usize>, Bound<usize>)>>::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<T, S> Index<Range<usize>> for IndexSet<T, S>

§

type Output = Slice<T>

The returned type after indexing.
source§

fn index( &self, range: Range<usize> ) -> &<IndexSet<T, S> as Index<Range<usize>>>::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<T, S> Index<RangeFrom<usize>> for IndexSet<T, S>

§

type Output = Slice<T>

The returned type after indexing.
source§

fn index( &self, range: RangeFrom<usize> ) -> &<IndexSet<T, S> as Index<RangeFrom<usize>>>::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<T, S> Index<RangeFull> for IndexSet<T, S>

§

type Output = Slice<T>

The returned type after indexing.
source§

fn index( &self, range: RangeFull ) -> &<IndexSet<T, S> as Index<RangeFull>>::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<T, S> Index<RangeInclusive<usize>> for IndexSet<T, S>

§

type Output = Slice<T>

The returned type after indexing.
source§

fn index( &self, range: RangeInclusive<usize> ) -> &<IndexSet<T, S> as Index<RangeInclusive<usize>>>::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<T, S> Index<RangeTo<usize>> for IndexSet<T, S>

§

type Output = Slice<T>

The returned type after indexing.
source§

fn index( &self, range: RangeTo<usize> ) -> &<IndexSet<T, S> as Index<RangeTo<usize>>>::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<T, S> Index<RangeToInclusive<usize>> for IndexSet<T, S>

§

type Output = Slice<T>

The returned type after indexing.
source§

fn index( &self, range: RangeToInclusive<usize> ) -> &<IndexSet<T, S> as Index<RangeToInclusive<usize>>>::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<T, S> Index<usize> for IndexSet<T, S>

Access IndexSet values at indexed positions.

§Examples

use indexmap::IndexSet;

let mut set = IndexSet::new();
for word in "Lorem ipsum dolor sit amet".split_whitespace() {
    set.insert(word.to_string());
}
assert_eq!(set[0], "Lorem");
assert_eq!(set[1], "ipsum");
set.reverse();
assert_eq!(set[0], "amet");
assert_eq!(set[1], "sit");
set.sort();
assert_eq!(set[0], "Lorem");
assert_eq!(set[1], "amet");
use indexmap::IndexSet;

let mut set = IndexSet::new();
set.insert("foo");
println!("{:?}", set[10]); // panics!
source§

fn index(&self, index: usize) -> &T

Returns a reference to the value at the supplied index.

Panics if index is out of bounds.

§

type Output = T

The returned type after indexing.
source§

impl<'de, T, S, E> IntoDeserializer<'de, E> for IndexSet<T, S>
where T: IntoDeserializer<'de, E> + Eq + Hash, S: BuildHasher, E: Error,

§

type Deserializer = SeqDeserializer<<IndexSet<T, S> as IntoIterator>::IntoIter, E>

The type of the deserializer being converted into.
source§

fn into_deserializer( self ) -> <IndexSet<T, S> as IntoDeserializer<'de, E>>::Deserializer

Convert this value into a deserializer.
source§

impl<'a, T, S> IntoIterator for &'a IndexSet<T, S>

§

type Item = &'a T

The type of the elements being iterated over.
§

type IntoIter = Iter<'a, T>

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

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

Creates an iterator from a value. Read more
source§

impl<T, S> IntoIterator for IndexSet<T, S>

§

type Item = T

The type of the elements being iterated over.
§

type IntoIter = IntoIter<T>

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

fn into_iter(self) -> <IndexSet<T, S> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
source§

impl<T, S1, S2> PartialEq<IndexSet<T, S2>> for IndexSet<T, S1>
where T: Hash + Eq, S1: BuildHasher, S2: BuildHasher,

source§

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

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

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

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

impl<T, S> Serialize for IndexSet<T, S>
where T: Serialize + Hash + Eq, S: BuildHasher,

Requires crate feature "serde"

source§

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

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

impl<T, S1, S2> Sub<&IndexSet<T, S2>> for &IndexSet<T, S1>
where T: Eq + Hash + Clone, S1: BuildHasher + Default, S2: BuildHasher,

source§

fn sub( self, other: &IndexSet<T, S2> ) -> <&IndexSet<T, S1> as Sub<&IndexSet<T, S2>>>::Output

Returns the set difference, cloned into a new set.

Values are collected in the same order that they appear in self.

§

type Output = IndexSet<T, S1>

The resulting type after applying the - operator.
source§

impl<T, S> Eq for IndexSet<T, S>
where T: Eq + Hash, S: BuildHasher,

Auto Trait Implementations§

§

impl<T, S> RefUnwindSafe for IndexSet<T, S>

§

impl<T, S> Send for IndexSet<T, S>
where S: Send, T: Send,

§

impl<T, S> Sync for IndexSet<T, S>
where S: Sync, T: Sync,

§

impl<T, S> Unpin for IndexSet<T, S>
where S: Unpin, T: Unpin,

§

impl<T, S> UnwindSafe for IndexSet<T, S>
where S: UnwindSafe, 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
§

impl<U> As for U

§

fn as_<T>(self) -> T
where T: CastFrom<U>,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. 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
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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.
§

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

§

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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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>,

§

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> BasicCategorize for T

source§

impl<T> BasicDecode for T

source§

impl<T> BasicDescribe for T

source§

impl<T> BasicEncode for T

source§

impl<T> BasicSbor for T

source§

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

source§

impl<T> ManifestCategorize for T

source§

impl<T> ManifestDecode for T

source§

impl<T> ManifestEncode for T

source§

impl<T> ScryptoCategorize for T

source§

impl<T> ScryptoDecode for T

source§

impl<T> ScryptoDescribe for T

source§

impl<T> ScryptoEncode for T

source§

impl<T> ScryptoSbor for T