Skip to main content

EntityIndexSet

Struct EntityIndexSet 

pub struct EntityIndexSet(/* private fields */);
Expand description

An [IndexSet] pre-configured to use EntityHash hashing.

Implementations§

§

impl EntityIndexSet

pub const fn new() -> EntityIndexSet

Creates an empty EntityIndexSet.

Equivalent to IndexSet::with_hasher(EntityHash).

pub fn with_capacity(n: usize) -> EntityIndexSet

Creates an empty EntityIndexSet with the specified capacity.

Equivalent to IndexSet::with_capacity_and_hasher(n, EntityHash).

pub const fn from_index_set(set: IndexSet<Entity, EntityHash>) -> EntityIndexSet

Constructs an EntityIndexSet from an [IndexSet].

pub fn into_inner(self) -> IndexSet<Entity, EntityHash>

Returns the inner [IndexSet].

pub fn as_slice(&self) -> &Slice

Returns a slice of all the values in the set.

Equivalent to [IndexSet::as_slice].

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

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

Equivalent to [IndexSet::drain].

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

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

Equivalent to [IndexSet::get_range].

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

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

Equivalent to [IndexSet::iter].

pub fn into_boxed_slice(self) -> Box<Slice>

Converts into a boxed slice of all the values in the set.

Equivalent to [IndexSet::into_boxed_slice].

Methods from Deref<Target = IndexSet<Entity, EntityHash>>§

pub fn capacity(&self) -> usize

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

pub fn hasher(&self) -> &S

Return a reference to the set’s BuildHasher.

pub fn len(&self) -> usize

Return the number of elements in the set.

Computes in O(1) time.

pub fn is_empty(&self) -> bool

Returns true if the set contains no elements.

Computes in O(1) time.

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

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

pub fn clear(&mut self)

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

Computes in O(n) time.

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.

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.

pub fn extract_if<F, R>(&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 the std::ops::Range* types, or even a tuple pair of Bound start and end values. To check the entire set, use RangeFull like set.extract_if(.., predicate).

If the returned ExtractIf is not exhausted, e.g. because it is dropped without iterating or the iteration short-circuits, then the remaining elements will be retained. Use retain with 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 indexmap::IndexSet;

let mut set: IndexSet<i32> = (0..8).collect();
let extracted: IndexSet<i32> = set.extract_if(.., |v| v % 2 == 0).collect();

let evens = extracted.into_iter().collect::<Vec<_>>();
let odds = set.into_iter().collect::<Vec<_>>();

assert_eq!(evens, vec![0, 2, 4, 6]);
assert_eq!(odds, vec![1, 3, 5, 7]);

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.

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

Reserve capacity for additional more values.

Computes in O(n) time.

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.

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

Try to reserve capacity for additional more values.

Computes in O(n) time.

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.

pub fn shrink_to_fit(&mut self)

Shrink the capacity of the set as much as possible.

Computes in O(n) time.

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

Shrink the capacity of the set with a lower limit.

Computes in O(n) time.

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

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

pub fn insert_sorted(&mut self, value: T) -> (usize, bool)
where T: Ord,

Insert 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 and true.

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.

pub fn insert_sorted_by<F>(&mut self, value: T, cmp: F) -> (usize, bool)
where F: FnMut(&T, &T) -> Ordering,

Insert the value into the set at its ordered position among values sorted by cmp.

This is equivalent to finding the position with [binary_search_by][Self::binary_search_by], then calling [insert_before][Self::insert_before].

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

pub fn insert_sorted_by_key<B, F>( &mut self, value: T, sort_key: F, ) -> (usize, bool)
where B: Ord, F: FnMut(&T) -> B,

Insert the value into the set at its ordered position among values using a sort-key extraction function.

This is equivalent to finding the position with [binary_search_by_key][Self::binary_search_by_key] with sort_key(key), then calling [insert_before][Self::insert_before].

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

pub fn insert_before(&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 false leaving 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. (See shift_insert for different behavior here.)

Otherwise, it inserts the new value exactly at the given index and returns true.

Panics if index is out of bounds. Valid indices are 0..=set.len() (inclusive).

Computes in O(n) time (average).

§Examples
use indexmap::IndexSet;
let mut set: IndexSet<char> = ('a'..='z').collect();

// The new value '*' goes exactly at the given index.
assert_eq!(set.get_index_of(&'*'), None);
assert_eq!(set.insert_before(10, '*'), (10, true));
assert_eq!(set.get_index_of(&'*'), Some(10));

// Moving the value 'a' up will shift others down, so this moves *before* 10 to index 9.
assert_eq!(set.insert_before(10, 'a'), (9, false));
assert_eq!(set.get_index_of(&'a'), Some(9));
assert_eq!(set.get_index_of(&'*'), Some(10));

// Moving the value 'z' down will shift others up, so this moves to exactly 10.
assert_eq!(set.insert_before(10, 'z'), (10, false));
assert_eq!(set.get_index_of(&'z'), Some(10));
assert_eq!(set.get_index_of(&'*'), Some(11));

// Moving or inserting before the endpoint is also valid.
assert_eq!(set.len(), 27);
assert_eq!(set.insert_before(set.len(), '*'), (26, false));
assert_eq!(set.get_index_of(&'*'), Some(26));
assert_eq!(set.insert_before(set.len(), '+'), (27, true));
assert_eq!(set.get_index_of(&'+'), Some(27));
assert_eq!(set.len(), 28);

pub fn shift_insert(&mut self, index: usize, value: T) -> bool

Insert the value into the set at the given index.

If an equivalent item already exists in the set, it returns false leaving the original value in the set, but moved to the given index. Note that existing values cannot be moved to index == set.len()! (See insert_before for different behavior here.)

Otherwise, it inserts the new value at the given index and returns true.

Panics if index is out of bounds. Valid indices are 0..set.len() (exclusive) when moving an existing value, or 0..=set.len() (inclusive) when inserting a new value.

Computes in O(n) time (average).

§Examples
use indexmap::IndexSet;
let mut set: IndexSet<char> = ('a'..='z').collect();

// The new value '*' goes exactly at the given index.
assert_eq!(set.get_index_of(&'*'), None);
assert_eq!(set.shift_insert(10, '*'), true);
assert_eq!(set.get_index_of(&'*'), Some(10));

// Moving the value 'a' up to 10 will shift others down, including the '*' that was at 10.
assert_eq!(set.shift_insert(10, 'a'), false);
assert_eq!(set.get_index_of(&'a'), Some(10));
assert_eq!(set.get_index_of(&'*'), Some(9));

// Moving the value 'z' down to 9 will shift others up, including the '*' that was at 9.
assert_eq!(set.shift_insert(9, 'z'), false);
assert_eq!(set.get_index_of(&'z'), Some(9));
assert_eq!(set.get_index_of(&'*'), Some(10));

// Existing values can move to len-1 at most, but new values can insert at the endpoint.
assert_eq!(set.len(), 27);
assert_eq!(set.shift_insert(set.len() - 1, '*'), false);
assert_eq!(set.get_index_of(&'*'), Some(26));
assert_eq!(set.shift_insert(set.len(), '+'), true);
assert_eq!(set.get_index_of(&'+'), Some(27));
assert_eq!(set.len(), 28);
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');

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

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

pub fn replace_index(&mut self, index: usize, value: T) -> Result<T, (usize, T)>

Replaces the value at the given index. The new value does not need to be equivalent to the one it is replacing, but it must be unique to the rest of the set.

Returns Ok(old_value) if successful, or Err((other_index, value)) if an equivalent value already exists at a different index. The set will be unchanged in the error case.

Panics if index is out of bounds.

Computes in O(1) time (average).

pub fn difference<'a, S2>( &'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.

pub fn symmetric_difference<'a, S2>( &'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.

pub fn intersection<'a, S2>( &'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.

pub fn union<'a, S2>(&'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.

pub fn splice<R, I>( &mut self, range: R, replace_with: I, ) -> Splice<'_, <I as IntoIterator>::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_with iterator and yields the removed items. replace_with does not need to be the same length as range.

The range is removed even if the iterator is not consumed until the end. It is unspecified how many elements are removed from the set if the Splice value is leaked.

The input iterator replace_with is only consumed when the Splice value is dropped. If a value from the iterator matches an existing entry in the set (outside of range), then the original will be unchanged. Otherwise, the new value will be inserted in the replaced range.

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 indexmap::IndexSet;

let mut set = IndexSet::from([0, 1, 2, 3, 4]);
let new = [5, 4, 3, 2, 1];
let removed: Vec<_> = set.splice(2..4, new).collect();

// 1 and 4 kept their positions, while 5, 3, and 2 were newly inserted.
assert!(set.into_iter().eq([0, 1, 5, 3, 2, 4]));
assert_eq!(removed, &[2, 3]);

pub fn append<S2>(&mut self, other: &mut IndexSet<T, S2>)

Moves all values from other into self, leaving other empty.

This is equivalent to calling [insert][Self::insert] for each value from other in order, which means that values that already exist in self are unchanged in their current position.

See also [union][Self::union] to iterate the combined values by reference, without modifying self or other.

§Examples
use indexmap::IndexSet;

let mut a = IndexSet::from([3, 2, 1]);
let mut b = IndexSet::from([3, 4, 5]);
let old_capacity = b.capacity();

a.append(&mut b);

assert_eq!(a.len(), 5);
assert_eq!(b.len(), 0);
assert_eq!(b.capacity(), old_capacity);

assert!(a.iter().eq(&[3, 2, 1, 4, 5]));

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

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

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

Return item index and value

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

Computes in O(1) time (average).

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

👎Deprecated:

remove disrupts the set order – use swap_remove or shift_remove for explicit behavior.

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

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

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

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

👎Deprecated:

take disrupts the set order – use swap_take or shift_take for explicit behavior.

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.

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

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

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.

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.

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

pub fn pop_if(&mut self, predicate: impl FnOnce(&T) -> bool) -> Option<T>

Removes and returns the last value from a set if the predicate returns true, or None if the predicate returns false or the set is empty (the predicate will not be called in that case).

This preserves the order of the remaining elements.

Computes in O(1) time (average).

§Examples
use indexmap::IndexSet;

let mut set = IndexSet::from([1, 2, 3, 4]);
let pred = |x: &i32| *x % 2 == 0;

assert_eq!(set.pop_if(pred), Some(4));
assert_eq!(set.as_slice(), &[1, 2, 3]);
assert_eq!(set.pop_if(pred), None);

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

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

Sort 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_by for details.

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.

pub fn sort_by_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.

Computes in O(n log n) time and O(n) space. The sort is stable.

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

Sort the set’s values by their default ordering.

See sort_unstable_by for details.

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 function cmp.

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

pub fn sort_unstable_by_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.

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

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.

Search 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_search for 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.

pub fn binary_search_by<'a, F>(&'a self, f: F) -> Result<usize, usize>
where F: FnMut(&'a T) -> Ordering,

Search 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_by for more details.

Computes in O(log(n)) time.

pub fn binary_search_by_key<'a, B, F>( &'a self, b: &B, f: F, ) -> Result<usize, usize>
where F: FnMut(&'a T) -> B, B: Ord,

Search 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_key for more details.

Computes in O(log(n)) time.

pub fn is_sorted(&self) -> bool
where T: PartialOrd,

Checks if the values of this set are sorted.

pub fn is_sorted_by<'a, F>(&'a self, cmp: F) -> bool
where F: FnMut(&'a T, &'a T) -> bool,

Checks if this set is sorted using the given comparator function.

pub fn is_sorted_by_key<'a, F, K>(&'a self, sort_key: F) -> bool
where F: FnMut(&'a T) -> K, K: PartialOrd,

Checks if this set is sorted using the given sort-key function.

pub fn partition_point<P>(&self, pred: P) -> usize
where P: FnMut(&T) -> bool,

Returns 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_point for more details.

Computes in O(log(n)) time.

pub fn reverse(&mut self)

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

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

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

Returns a slice of all the values in the set.

Computes in O(1) time.

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.

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.

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

Get the first value

Computes in O(1) time.

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

Get the last value

Computes in O(1) time.

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

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

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

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.

Computes in O(1) time (average).

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.

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.

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§

§

impl BitAnd for &EntityIndexSet

§

type Output = EntityIndexSet

The resulting type after applying the & operator.
§

fn bitand(self, rhs: &EntityIndexSet) -> <&EntityIndexSet as BitAnd>::Output

Performs the & operation. Read more
§

impl BitOr for &EntityIndexSet

§

type Output = EntityIndexSet

The resulting type after applying the | operator.
§

fn bitor(self, rhs: &EntityIndexSet) -> <&EntityIndexSet as BitOr>::Output

Performs the | operation. Read more
§

impl BitXor for &EntityIndexSet

§

type Output = EntityIndexSet

The resulting type after applying the ^ operator.
§

fn bitxor(self, rhs: &EntityIndexSet) -> <&EntityIndexSet as BitXor>::Output

Performs the ^ operation. Read more
§

impl Clone for EntityIndexSet

§

fn clone(&self) -> EntityIndexSet

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for EntityIndexSet

§

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

Formats the value using the given formatter. Read more
§

impl Default for EntityIndexSet

§

fn default() -> EntityIndexSet

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

impl Deref for EntityIndexSet

§

type Target = IndexSet<Entity, EntityHash>

The resulting type after dereferencing.
§

fn deref(&self) -> &<EntityIndexSet as Deref>::Target

Dereferences the value.
§

impl DerefMut for EntityIndexSet

§

fn deref_mut(&mut self) -> &mut <EntityIndexSet as Deref>::Target

Mutably dereferences the value.
§

impl<'a> Extend<&'a Entity> for EntityIndexSet

§

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

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
§

impl Extend<Entity> for EntityIndexSet

§

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

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
§

impl<const N: usize> From<[Entity; N]> for EntityIndexSet

§

fn from(value: [Entity; N]) -> EntityIndexSet

Converts to this type from the input type.
§

impl FromIterator<Entity> for EntityIndexSet

§

fn from_iter<I>(iterable: I) -> EntityIndexSet
where I: IntoIterator<Item = Entity>,

Creates a value from an iterator. Read more
§

impl FromReflect for EntityIndexSet

§

fn from_reflect( reflect: &(dyn PartialReflect + 'static), ) -> Option<EntityIndexSet>

Constructs a concrete instance of Self from a reflected value.
§

fn take_from_reflect( reflect: Box<dyn PartialReflect>, ) -> Result<Self, Box<dyn PartialReflect>>

Attempts to downcast the given value to Self using, constructing the value using from_reflect if that fails. Read more
§

impl GetTypeRegistration for EntityIndexSet

§

fn get_type_registration() -> TypeRegistration

Returns the default [TypeRegistration] for this type.
§

fn register_type_dependencies(registry: &mut TypeRegistry)

Registers other types needed by this type. Read more
§

impl Index<(Bound<usize>, Bound<usize>)> for EntityIndexSet

§

type Output = Slice

The returned type after indexing.
§

fn index( &self, key: (Bound<usize>, Bound<usize>), ) -> &<EntityIndexSet as Index<(Bound<usize>, Bound<usize>)>>::Output

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

impl Index<Range<usize>> for EntityIndexSet

§

type Output = Slice

The returned type after indexing.
§

fn index( &self, key: Range<usize>, ) -> &<EntityIndexSet as Index<Range<usize>>>::Output

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

impl Index<RangeFrom<usize>> for EntityIndexSet

§

type Output = Slice

The returned type after indexing.
§

fn index( &self, key: RangeFrom<usize>, ) -> &<EntityIndexSet as Index<RangeFrom<usize>>>::Output

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

impl Index<RangeFull> for EntityIndexSet

§

type Output = Slice

The returned type after indexing.
§

fn index(&self, key: RangeFull) -> &<EntityIndexSet as Index<RangeFull>>::Output

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

impl Index<RangeInclusive<usize>> for EntityIndexSet

§

type Output = Slice

The returned type after indexing.
§

fn index( &self, key: RangeInclusive<usize>, ) -> &<EntityIndexSet as Index<RangeInclusive<usize>>>::Output

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

impl Index<RangeTo<usize>> for EntityIndexSet

§

type Output = Slice

The returned type after indexing.
§

fn index( &self, key: RangeTo<usize>, ) -> &<EntityIndexSet as Index<RangeTo<usize>>>::Output

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

impl Index<RangeToInclusive<usize>> for EntityIndexSet

§

type Output = Slice

The returned type after indexing.
§

fn index( &self, key: RangeToInclusive<usize>, ) -> &<EntityIndexSet as Index<RangeToInclusive<usize>>>::Output

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

impl Index<usize> for EntityIndexSet

§

type Output = Entity

The returned type after indexing.
§

fn index(&self, key: usize) -> &Entity

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

impl<'a> IntoIterator for &'a EntityIndexSet

§

type Item = &'a Entity

The type of the elements being iterated over.
§

type IntoIter = Iter<'a>

Which kind of iterator are we turning this into?
§

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

Creates an iterator from a value. Read more
§

impl IntoIterator for EntityIndexSet

§

type Item = Entity

The type of the elements being iterated over.
§

type IntoIter = IntoIter

Which kind of iterator are we turning this into?
§

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

Creates an iterator from a value. Read more
§

impl MapEntities for EntityIndexSet

§

fn map_entities<E>(&mut self, entity_mapper: &mut E)
where E: EntityMapper,

Updates all Entity references stored inside using entity_mapper. Read more
§

impl<S2> PartialEq<IndexSet<Entity, S2>> for EntityIndexSet
where S2: BuildHasher,

§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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.
§

impl PartialEq for EntityIndexSet

§

fn eq(&self, other: &EntityIndexSet) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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.
§

impl PartialReflect for EntityIndexSet

§

fn get_represented_type_info(&self) -> Option<&'static TypeInfo>

Returns the [TypeInfo] of the type represented by this value. Read more
§

fn try_apply( &mut self, value: &(dyn PartialReflect + 'static), ) -> Result<(), ApplyError>

Tries to apply a reflected value to this value. Read more
§

fn reflect_kind(&self) -> ReflectKind

Returns a zero-sized enumeration of “kinds” of type. Read more
§

fn reflect_ref(&self) -> ReflectRef<'_>

Returns an immutable enumeration of “kinds” of type. Read more
§

fn reflect_mut(&mut self) -> ReflectMut<'_>

Returns a mutable enumeration of “kinds” of type. Read more
§

fn reflect_owned(self: Box<EntityIndexSet>) -> ReflectOwned

Returns an owned enumeration of “kinds” of type. Read more
§

fn try_into_reflect( self: Box<EntityIndexSet>, ) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>>

Attempts to cast this type to a boxed, fully-reflected value.
§

fn try_as_reflect(&self) -> Option<&(dyn Reflect + 'static)>

Attempts to cast this type to a fully-reflected value.
§

fn try_as_reflect_mut(&mut self) -> Option<&mut (dyn Reflect + 'static)>

Attempts to cast this type to a mutable, fully-reflected value.
§

fn into_partial_reflect(self: Box<EntityIndexSet>) -> Box<dyn PartialReflect>

Casts this type to a boxed, reflected value. Read more
§

fn as_partial_reflect(&self) -> &(dyn PartialReflect + 'static)

Casts this type to a reflected value. Read more
§

fn as_partial_reflect_mut(&mut self) -> &mut (dyn PartialReflect + 'static)

Casts this type to a mutable, reflected value. Read more
§

fn reflect_partial_eq( &self, value: &(dyn PartialReflect + 'static), ) -> Option<bool>

Returns a “partial equality” comparison result. Read more
§

fn reflect_partial_cmp( &self, value: &(dyn PartialReflect + 'static), ) -> Option<Ordering>

Returns a “partial comparison” result. Read more
§

fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError>

Attempts to clone Self using reflection. Read more
§

fn apply(&mut self, value: &(dyn PartialReflect + 'static))

Applies a reflected value to this value. Read more
§

fn to_dynamic(&self) -> Box<dyn PartialReflect>

Converts this reflected value into its dynamic representation based on its kind. Read more
§

fn reflect_clone_and_take<T>(&self) -> Result<T, ReflectCloneError>
where T: 'static, Self: Sized + TypePath,

For a type implementing [PartialReflect], combines reflect_clone and take in a useful fashion, automatically constructing an appropriate [ReflectCloneError] if the downcast fails.
§

fn reflect_hash(&self) -> Option<u64>

Returns a hash of the value (which includes the type). Read more
§

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

Debug formatter for the value. Read more
§

fn is_dynamic(&self) -> bool

Indicates whether or not this type is a dynamic type. Read more
§

impl Reflect for EntityIndexSet

§

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

Returns the value as a Box<dyn Any>. Read more
§

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

Returns the value as a &dyn Any. Read more
§

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

Returns the value as a &mut dyn Any. Read more
§

fn into_reflect(self: Box<EntityIndexSet>) -> Box<dyn Reflect>

Casts this type to a boxed, fully-reflected value.
§

fn as_reflect(&self) -> &(dyn Reflect + 'static)

Casts this type to a fully-reflected value.
§

fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)

Casts this type to a mutable, fully-reflected value.
§

fn set(&mut self, value: Box<dyn Reflect>) -> Result<(), Box<dyn Reflect>>

Performs a type-checked assignment of a reflected value to this value. Read more
§

impl RelationshipSourceCollection for EntityIndexSet

§

type SourceIter<'a> = Copied<Iter<'a>>

The type of iterator returned by the iter method. Read more
§

fn new() -> EntityIndexSet

Creates a new empty instance.
§

fn reserve(&mut self, additional: usize)

Reserves capacity for at least additional more entities to be inserted. Read more
§

fn with_capacity(capacity: usize) -> EntityIndexSet

Returns an instance with the given pre-allocated entity capacity. Read more
§

fn add(&mut self, entity: Entity) -> bool

Adds the given entity to the collection. Read more
§

fn remove(&mut self, entity: Entity) -> bool

Removes the given entity from the collection. Read more
§

fn iter( &self, ) -> <EntityIndexSet as RelationshipSourceCollection>::SourceIter<'_>

Iterates all entities in the collection.
§

fn len(&self) -> usize

Returns the current length of the collection.
§

fn clear(&mut self)

Clears the collection.
§

fn shrink_to_fit(&mut self)

Attempts to save memory by shrinking the capacity to fit the current length. Read more
§

fn extend_from_iter(&mut self, entities: impl IntoIterator<Item = Entity>)

Add multiple entities to collection at once. Read more
§

fn is_empty(&self) -> bool

Returns true if the collection contains no entities.
§

fn source_to_remove_before_add(&self) -> Option<Entity>

For one-to-one relationships, returns the entity that should be removed before adding a new one. Returns None for one-to-many relationships or when no entity needs to be removed.
§

impl Sub for &EntityIndexSet

§

type Output = EntityIndexSet

The resulting type after applying the - operator.
§

fn sub(self, rhs: &EntityIndexSet) -> <&EntityIndexSet as Sub>::Output

Performs the - operation. Read more
§

impl TupleStruct for EntityIndexSet

§

fn field(&self, index: usize) -> Option<&(dyn PartialReflect + 'static)>

Returns a reference to the value of the field with index index as a &dyn Reflect.
§

fn field_mut( &mut self, index: usize, ) -> Option<&mut (dyn PartialReflect + 'static)>

Returns a mutable reference to the value of the field with index index as a &mut dyn Reflect.
§

fn field_len(&self) -> usize

Returns the number of fields in the tuple struct.
§

fn iter_fields(&self) -> TupleStructFieldIter<'_>

Returns an iterator over the values of the tuple struct’s fields.
§

fn to_dynamic_tuple_struct(&self) -> DynamicTupleStruct

Creates a new [DynamicTupleStruct] from this tuple struct.
§

fn get_represented_tuple_struct_info(&self) -> Option<&'static TupleStructInfo>

Will return None if [TypeInfo] is not available.
§

impl TypePath for EntityIndexSet

§

fn type_path() -> &'static str

Returns the fully qualified path of the underlying type. Read more
§

fn short_type_path() -> &'static str

Returns a short, pretty-print enabled path to the type. Read more
§

fn type_ident() -> Option<&'static str>

Returns the name of the type, or None if it is anonymous. Read more
§

fn crate_name() -> Option<&'static str>

Returns the name of the crate the type is in, or None if it is anonymous. Read more
§

fn module_path() -> Option<&'static str>

Returns the path to the module the type is in, or None if it is anonymous. Read more
§

impl Typed for EntityIndexSet

§

fn type_info() -> &'static TypeInfo

Returns the compile-time info for the underlying type.
§

impl Eq for EntityIndexSet

Auto Trait Implementations§

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<I> BidiIterator for I

§

fn bidi(self, cond: bool) -> Bidi<Self::IntoIter>

Conditionally reverses the direction of iteration. 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, dest: *mut u8)

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

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
§

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

§

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

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

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

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

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

Converts &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)

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

impl<T> DowncastSend for T
where T: Any + Send,

§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DynEq for T
where T: Any + Eq,

§

fn dyn_eq(&self, other: &(dyn DynEq + 'static)) -> bool

This method tests for self and other values to be equal. Read more
§

impl<T> DynamicTypePath for T
where T: TypePath,

§

fn reflect_type_path(&self) -> &str

See [TypePath::type_path].
§

fn reflect_short_type_path(&self) -> &str

See [TypePath::short_type_path].
§

fn reflect_type_ident(&self) -> Option<&str>

See [TypePath::type_ident].
§

fn reflect_crate_name(&self) -> Option<&str>

See [TypePath::crate_name].
§

fn reflect_module_path(&self) -> Option<&str>

See [TypePath::module_path].
§

impl<T> DynamicTyped for T
where T: Typed,

§

fn reflect_type_info(&self) -> &'static TypeInfo

See [Typed::type_info].
§

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

§

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
§

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
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromTemplate for T
where T: Clone + Default + Unpin,

§

type Template = T

The Template for this type.
§

impl<T> FromWorld for T
where T: Default,

§

fn from_world(_world: &mut World) -> T

Creates Self using default().

§

impl<T> GetPath for T
where T: Reflect + ?Sized,

§

fn reflect_path<'p>( &self, path: impl ReflectPath<'p>, ) -> Result<&(dyn PartialReflect + 'static), ReflectPathError<'p>>

Returns a reference to the value specified by path. Read more
§

fn reflect_path_mut<'p>( &mut self, path: impl ReflectPath<'p>, ) -> Result<&mut (dyn PartialReflect + 'static), ReflectPathError<'p>>

Returns a mutable reference to the value specified by path. Read more
§

fn path<'p, T>( &self, path: impl ReflectPath<'p>, ) -> Result<&T, ReflectPathError<'p>>
where T: Reflect,

Returns a statically typed reference to the value specified by path. Read more
§

fn path_mut<'p, T>( &mut self, path: impl ReflectPath<'p>, ) -> Result<&mut T, ReflectPathError<'p>>
where T: Reflect,

Returns a statically typed mutable reference to the value specified by path. Read more
§

impl<S> GetTupleStructField for S
where S: TupleStruct,

§

fn get_field<T>(&self, index: usize) -> Option<&T>
where T: Reflect,

Returns a reference to the value of the field with index index, downcast to T.
§

fn get_field_mut<T>(&mut self, index: usize) -> Option<&mut T>
where T: Reflect,

Returns a mutable reference to the value of the field with index index, downcast to T.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoResult<T> for T

§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
§

impl<A> Is for A
where A: Any,

§

fn is<T>() -> bool
where T: Any,

Checks if the current type “is” another type, using a TypeId equality comparison. This is most useful in the context of generic logic. Read more
§

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

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
§

impl<T> Template for T
where T: Clone + Default + Unpin,

§

type Output = T

The type of value produced by this Template.
§

fn build_template( &self, _context: &mut TemplateContext<'_, '_>, ) -> Result<<T as Template>::Output, BevyError>

Uses this template and the given entity context to produce a Template::Output.
§

fn clone_template(&self) -> T

Clones this template. See Clone.
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
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. 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.
§

impl<T> TypeData for T
where T: 'static + Send + Sync + Clone,

§

fn clone_type_data(&self) -> Box<dyn TypeData>

Creates a type-erased clone of this value.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

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

§

impl<T> EntitySet for T

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> Reflectable for T
where T: Reflect + GetTypeRegistration + Typed + TypePath,