Skip to main content

FixedBitSet

Struct FixedBitSet 

pub struct FixedBitSet { /* private fields */ }
Expand description

FixedBitSet is a simple fixed size set of bits that each can be enabled (1 / true) or disabled (0 / false).

The bit set has a fixed capacity in terms of enabling bits (and the capacity can grow using the grow method).

Derived traits depend on both the zeros and ones, so [0,1] is not equal to [0,1,0].

Implementations§

§

impl FixedBitSet

pub const fn new() -> FixedBitSet

Create a new empty FixedBitSet.

pub fn with_capacity(bits: usize) -> FixedBitSet

Create a new FixedBitSet with a specific number of bits, all initially clear.

pub fn with_capacity_and_blocks<I>(bits: usize, blocks: I) -> FixedBitSet
where I: IntoIterator<Item = usize>,

Create a new FixedBitSet with a specific number of bits, initialized from provided blocks.

If the blocks are not the exact size needed for the capacity they will be padded with zeros (if shorter) or truncated to the capacity (if longer).

For example:

let data = vec![4];
let bs = fixedbitset::FixedBitSet::with_capacity_and_blocks(4, data);
assert_eq!(format!("{:b}", bs), "0010");

pub fn grow(&mut self, bits: usize)

Grow capacity to bits, all new bits initialized to zero

pub fn grow_and_insert(&mut self, bits: usize)

Grows the internal size of the bitset before inserting a bit

Unlike insert, this cannot panic, but may allocate if the bit is outside of the existing buffer’s range.

This is faster than calling grow then insert in succession.

pub fn len(&self) -> usize

The length of the FixedBitSet in bits.

Note: len includes both set and unset bits.

let bitset = FixedBitSet::with_capacity(10);
// there are 0 set bits, but 10 unset bits
assert_eq!(bitset.len(), 10);

len does not return the count of set bits. For that, use bitset.count_ones(..) instead.

pub fn is_empty(&self) -> bool

true if the FixedBitSet is empty.

Note that an “empty” FixedBitSet is a FixedBitSet with no bits (meaning: it’s length is zero). If you want to check if all bits are unset, use FixedBitSet::is_clear.

let bitset = FixedBitSet::with_capacity(10);
assert!(!bitset.is_empty());

let bitset = FixedBitSet::with_capacity(0);
assert!(bitset.is_empty());

pub fn is_clear(&self) -> bool

true if all bits in the FixedBitSet are unset.

As opposed to FixedBitSet::is_empty, which is true only for sets without any bits, set or unset.

let mut bitset = FixedBitSet::with_capacity(10);
assert!(bitset.is_clear());

bitset.insert(2);
assert!(!bitset.is_clear());

This is equivalent to bitset.count_ones(..) == 0.

pub fn minimum(&self) -> Option<usize>

Finds the lowest set bit in the bitset.

Returns None if there aren’t any set bits.

let mut bitset = FixedBitSet::with_capacity(10);
assert_eq!(bitset.minimum(), None);

bitset.insert(2);
assert_eq!(bitset.minimum(), Some(2));
bitset.insert(8);
assert_eq!(bitset.minimum(), Some(2));

pub fn maximum(&self) -> Option<usize>

Finds the highest set bit in the bitset.

Returns None if there aren’t any set bits.

let mut bitset = FixedBitSet::with_capacity(10);
assert_eq!(bitset.maximum(), None);

bitset.insert(8);
assert_eq!(bitset.maximum(), Some(8));
bitset.insert(2);
assert_eq!(bitset.maximum(), Some(8));

pub fn is_full(&self) -> bool

true if all bits in the FixedBitSet are set.

let mut bitset = FixedBitSet::with_capacity(10);
assert!(!bitset.is_full());

bitset.insert_range(..);
assert!(bitset.is_full());

This is equivalent to bitset.count_ones(..) == bitset.len().

pub fn contains(&self, bit: usize) -> bool

Return true if the bit is enabled in the FixedBitSet, false otherwise.

Note: bits outside the capacity are always disabled.

Note: Also available with index syntax: bitset[bit].

pub unsafe fn contains_unchecked(&self, bit: usize) -> bool

Return true if the bit is enabled in the FixedBitSet, false otherwise.

Note: unlike contains, calling this with an invalid bit is undefined behavior.

§Safety

bit must be less than self.len()

pub fn clear(&mut self)

Clear all bits.

pub fn insert(&mut self, bit: usize)

Enable bit.

Panics if bit is out of bounds.

pub unsafe fn insert_unchecked(&mut self, bit: usize)

Enable bit without any length checks.

§Safety

bit must be less than self.len()

pub fn remove(&mut self, bit: usize)

Disable bit.

Panics if bit is out of bounds.

pub unsafe fn remove_unchecked(&mut self, bit: usize)

Disable bit without any bounds checking.

§Safety

bit must be less than self.len()

pub fn put(&mut self, bit: usize) -> bool

Enable bit, and return its previous value.

Panics if bit is out of bounds.

pub unsafe fn put_unchecked(&mut self, bit: usize) -> bool

Enable bit, and return its previous value without doing any bounds checking.

§Safety

bit must be less than self.len()

pub fn toggle(&mut self, bit: usize)

Toggle bit (inverting its state).

Panics if bit is out of bounds

pub unsafe fn toggle_unchecked(&mut self, bit: usize)

Toggle bit (inverting its state) without any bounds checking.

§Safety

bit must be less than self.len()

pub fn set(&mut self, bit: usize, enabled: bool)

Sets a bit to the provided enabled value.

Panics if bit is out of bounds.

pub unsafe fn set_unchecked(&mut self, bit: usize, enabled: bool)

Sets a bit to the provided enabled value without doing any bounds checking.

§Safety

bit must be less than self.len()

pub fn copy_bit(&mut self, from: usize, to: usize)

Copies boolean value from specified bit to the specified bit.

If from is out-of-bounds, to will be unset.

Panics if to is out of bounds.

pub unsafe fn copy_bit_unchecked(&mut self, from: usize, to: usize)

Copies boolean value from specified bit to the specified bit.

Note: unlike copy_bit, calling this with an invalid from is undefined behavior.

§Safety

to must both be less than self.len()

pub fn count_ones<T>(&self, range: T) -> usize
where T: IndexRange,

Count the number of set bits in the given bit range.

This function is potentially much faster than using ones(other).count(). Use .. to count the whole content of the bitset.

Panics if the range extends past the end of the bitset.

pub fn count_zeroes<T>(&self, range: T) -> usize
where T: IndexRange,

Count the number of unset bits in the given bit range.

This function is potentially much faster than using zeroes(other).count(). Use .. to count the whole content of the bitset.

Panics if the range extends past the end of the bitset.

pub fn set_range<T>(&mut self, range: T, enabled: bool)
where T: IndexRange,

Sets every bit in the given range to the given state (enabled)

Use .. to set the whole bitset.

Panics if the range extends past the end of the bitset.

pub fn insert_range<T>(&mut self, range: T)
where T: IndexRange,

Enables every bit in the given range.

Use .. to make the whole bitset ones.

Panics if the range extends past the end of the bitset.

pub fn remove_range<T>(&mut self, range: T)
where T: IndexRange,

Disables every bit in the given range.

Use .. to make the whole bitset ones.

Panics if the range extends past the end of the bitset.

pub fn toggle_range<T>(&mut self, range: T)
where T: IndexRange,

Toggles (inverts) every bit in the given range.

Use .. to toggle the whole bitset.

Panics if the range extends past the end of the bitset.

pub fn contains_all_in_range<T>(&self, range: T) -> bool
where T: IndexRange,

Checks if the bitset contains every bit in the given range.

Panics if the range extends past the end of the bitset.

pub fn contains_any_in_range<T>(&self, range: T) -> bool
where T: IndexRange,

Checks if the bitset contains at least one set bit in the given range.

Panics if the range extends past the end of the bitset.

pub fn as_slice(&self) -> &[usize]

View the bitset as a slice of Block blocks

pub fn as_mut_slice(&mut self) -> &mut [usize]

View the bitset as a mutable slice of Block blocks. Writing past the bitlength in the last will cause contains to return potentially incorrect results for bits past the bitlength.

pub fn ones(&self) -> Ones<'_>

Iterates over all enabled bits.

Iterator element is the index of the 1 bit, type usize.

pub fn into_ones(self) -> IntoOnes

Iterates over all enabled bits.

Iterator element is the index of the 1 bit, type usize. Unlike ones, this function consumes the FixedBitset.

pub fn zeroes(&self) -> Zeroes<'_>

Iterates over all disabled bits.

Iterator element is the index of the 0 bit, type usize.

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

Returns a lazy iterator over the intersection of two FixedBitSets

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

Returns a lazy iterator over the union of two FixedBitSets.

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

Returns a lazy iterator over the difference of two FixedBitSets. The difference of a and b is the elements of a which are not in b.

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

Returns a lazy iterator over the symmetric difference of two FixedBitSets. The symmetric difference of a and b is the elements of one, but not both, sets.

pub fn union_with(&mut self, other: &FixedBitSet)

In-place union of two FixedBitSets.

On calling this method, self’s capacity may be increased to match other’s.

pub fn intersect_with(&mut self, other: &FixedBitSet)

In-place intersection of two FixedBitSets.

On calling this method, self’s capacity will remain the same as before.

pub fn difference_with(&mut self, other: &FixedBitSet)

In-place difference of two FixedBitSets.

On calling this method, self’s capacity will remain the same as before.

pub fn symmetric_difference_with(&mut self, other: &FixedBitSet)

In-place symmetric difference of two FixedBitSets.

On calling this method, self’s capacity may be increased to match other’s.

pub fn union_count(&self, other: &FixedBitSet) -> usize

Computes how many bits would be set in the union between two bitsets.

This is potentially much faster than using union(other).count(). Unlike other methods like using [union_with] followed by [count_ones], this does not mutate in place or require separate allocations.

pub fn intersection_count(&self, other: &FixedBitSet) -> usize

Computes how many bits would be set in the intersection between two bitsets.

This is potentially much faster than using intersection(other).count(). Unlike other methods like using [intersect_with] followed by [count_ones], this does not mutate in place or require separate allocations.

pub fn difference_count(&self, other: &FixedBitSet) -> usize

Computes how many bits would be set in the difference between two bitsets.

This is potentially much faster than using difference(other).count(). Unlike other methods like using [difference_with] followed by [count_ones], this does not mutate in place or require separate allocations.

pub fn symmetric_difference_count(&self, other: &FixedBitSet) -> usize

Computes how many bits would be set in the symmetric difference between two bitsets.

This is potentially much faster than using symmetric_difference(other).count(). Unlike other methods like using [symmetric_difference_with] followed by [count_ones], this does not mutate in place or require separate allocations.

pub fn is_disjoint(&self, other: &FixedBitSet) -> bool

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

pub fn is_subset(&self, other: &FixedBitSet) -> bool

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

pub fn is_superset(&self, other: &FixedBitSet) -> bool

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

Trait Implementations§

§

impl Binary for FixedBitSet

§

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

Formats the value using the given formatter. Read more
§

impl<'a> BitAnd for &'a FixedBitSet

§

type Output = FixedBitSet

The resulting type after applying the & operator.
§

fn bitand(self, other: &FixedBitSet) -> FixedBitSet

Performs the & operation. Read more
§

impl BitAndAssign<&FixedBitSet> for FixedBitSet

§

fn bitand_assign(&mut self, other: &FixedBitSet)

Performs the &= operation. Read more
§

impl BitAndAssign for FixedBitSet

§

fn bitand_assign(&mut self, other: FixedBitSet)

Performs the &= operation. Read more
§

impl<'a> BitOr for &'a FixedBitSet

§

type Output = FixedBitSet

The resulting type after applying the | operator.
§

fn bitor(self, other: &FixedBitSet) -> FixedBitSet

Performs the | operation. Read more
§

impl BitOrAssign<&FixedBitSet> for FixedBitSet

§

fn bitor_assign(&mut self, other: &FixedBitSet)

Performs the |= operation. Read more
§

impl BitOrAssign for FixedBitSet

§

fn bitor_assign(&mut self, other: FixedBitSet)

Performs the |= operation. Read more
§

impl<'a> BitXor for &'a FixedBitSet

§

type Output = FixedBitSet

The resulting type after applying the ^ operator.
§

fn bitxor(self, other: &FixedBitSet) -> FixedBitSet

Performs the ^ operation. Read more
§

impl BitXorAssign<&FixedBitSet> for FixedBitSet

§

fn bitxor_assign(&mut self, other: &FixedBitSet)

Performs the ^= operation. Read more
§

impl BitXorAssign for FixedBitSet

§

fn bitxor_assign(&mut self, other: FixedBitSet)

Performs the ^= operation. Read more
§

impl Clone for FixedBitSet

§

fn clone(&self) -> FixedBitSet

Returns a duplicate of the value. Read more
§

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

Performs copy-assignment from source. Read more
§

impl Debug for FixedBitSet

§

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

Formats the value using the given formatter. Read more
§

impl Default for FixedBitSet

§

fn default() -> FixedBitSet

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

impl Display for FixedBitSet

§

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

Formats the value using the given formatter. Read more
§

impl Drop for FixedBitSet

§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
§

impl Extend<usize> for FixedBitSet

Sets the bit at index i to true for each item i in the input src.

§

fn extend<I>(&mut self, src: I)
where I: IntoIterator<Item = usize>,

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<N> FilterNode<N> for &FixedBitSet

Source§

fn include_node(&self, n: N) -> bool

Return true to have the node be part of the graph
Source§

impl<N> FilterNode<N> for FixedBitSet

This filter includes the nodes that are contained in the set.

Source§

fn include_node(&self, n: N) -> bool

Return true to have the node be part of the graph
§

impl FromIterator<usize> for FixedBitSet

Return a FixedBitSet containing bits set to true for every bit index in the iterator, other bits are set to false.

§

fn from_iter<I>(src: I) -> FixedBitSet
where I: IntoIterator<Item = usize>,

Creates a value from an iterator. Read more
§

impl Hash for FixedBitSet

§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl Index<usize> for FixedBitSet

Return true if the bit is enabled in the bitset, or false otherwise.

Note: bits outside the capacity are always disabled, and thus indexing a FixedBitSet will not panic.

§

type Output = bool

The returned type after indexing.
§

fn index(&self, bit: usize) -> &bool

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

impl Ord for FixedBitSet

§

fn cmp(&self, other: &FixedBitSet) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
§

impl PartialEq for FixedBitSet

§

fn eq(&self, other: &FixedBitSet) -> 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 PartialOrd for FixedBitSet

§

fn partial_cmp(&self, other: &FixedBitSet) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<Ix> VisitMap<Ix> for FixedBitSet
where Ix: IndexType,

Source§

fn visit(&mut self, x: Ix) -> bool

Mark a as visited. Read more
Source§

fn is_visited(&self, x: &Ix) -> bool

Return whether a has been visited before.
Source§

fn unvisit(&mut self, x: Ix) -> bool

Mark a as unvisited. Read more
§

impl Eq for FixedBitSet

§

impl Send for FixedBitSet

§

impl Sync for FixedBitSet

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
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<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

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> DynHash for T
where T: DynEq + Hash,

§

fn dyn_hash(&self, state: &mut dyn Hasher)

Feeds this value into the given Hasher.
§

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

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,