[][src]Struct bevy::prelude::Children

pub struct Children(pub SmallVec<[Entity; 8]>);

Implementations

impl Children[src]

pub fn with(entity: &[Entity]) -> Children[src]

Methods from Deref<Target = SmallVec<[Entity; 8]>>

pub unsafe fn set_len(&mut self, new_len: usize)

Sets the length of a vector.

This will explicitly set the size of the vector, without actually modifying its buffers, so it is up to the caller to ensure that the vector is actually the specified size.

pub fn inline_size(&self) -> usize

The maximum number of elements this vector can hold inline

pub fn len(&self) -> usize

The number of elements stored in the vector

pub fn is_empty(&self) -> bool

Returns true if the vector is empty

pub fn capacity(&self) -> usize

The number of items the vector can hold without reallocating

pub fn spilled(&self) -> bool

Returns true if the data has spilled into a separate heap-allocated buffer.

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

Creates a draining iterator that removes the specified range in the vector and yields the removed items.

Note 1: The element range is removed even if the iterator is only partially consumed or not consumed at all.

Note 2: It is unspecified how many elements are removed from the vector if the Drain value is leaked.

Panics

Panics if the starting point is greater than the end point or if the end point is greater than the length of the vector.

pub fn push(&mut self, value: <A as Array>::Item)

Append an item to the vector.

pub fn pop(&mut self) -> Option<<A as Array>::Item>

Remove an item from the end of the vector and return it, or None if empty.

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

Re-allocate to set the capacity to max(new_cap, inline_size()).

Panics if new_cap is less than the vector's length or if the capacity computation overflows usize.

pub fn try_grow(&mut self, new_cap: usize) -> Result<(), CollectionAllocErr>

Re-allocate to set the capacity to max(new_cap, inline_size()).

Panics if new_cap is less than the vector's length

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

Reserve capacity for additional more elements to be inserted.

May reserve more space to avoid frequent reallocations.

Panics if the capacity computation overflows usize.

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

Reserve capacity for additional more elements to be inserted.

May reserve more space to avoid frequent reallocations.

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

Reserve the minimum capacity for additional more elements to be inserted.

Panics if the new capacity overflows usize.

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

Reserve the minimum capacity for additional more elements to be inserted.

pub fn shrink_to_fit(&mut self)

Shrink the capacity of the vector as much as possible.

When possible, this will move data from an external heap buffer to the vector's inline storage.

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

Shorten the vector, keeping the first len elements and dropping the rest.

If len is greater than or equal to the vector's current length, this has no effect.

This does not re-allocate. If you want the vector's capacity to shrink, call shrink_to_fit after truncating.

pub fn as_slice(&self) -> &[<A as Array>::Item]

Extracts a slice containing the entire vector.

Equivalent to &s[..].

pub fn as_mut_slice(&mut self) -> &mut [<A as Array>::Item]

Extracts a mutable slice of the entire vector.

Equivalent to &mut s[..].

pub fn swap_remove(&mut self, index: usize) -> <A as Array>::Item

Remove the element at position index, replacing it with the last element.

This does not preserve ordering, but is O(1).

Panics if index is out of bounds.

pub fn clear(&mut self)

Remove all elements from the vector.

pub fn remove(&mut self, index: usize) -> <A as Array>::Item

Remove and return the element at position index, shifting all elements after it to the left.

Panics if index is out of bounds.

pub fn insert(&mut self, index: usize, element: <A as Array>::Item)

Insert an element at position index, shifting all elements after it to the right.

Panics if index is out of bounds.

pub fn insert_many<I>(&mut self, index: usize, iterable: I) where
    I: IntoIterator<Item = <A as Array>::Item>, 

Insert multiple elements at position index, shifting all following elements toward the back.

pub fn retain<F>(&mut self, f: F) where
    F: FnMut(&mut <A as Array>::Item) -> bool

Retains only the elements specified by the predicate.

In other words, remove all elements e such that f(&e) returns false. This method operates in place and preserves the order of the retained elements.

pub fn dedup(&mut self) where
    <A as Array>::Item: PartialEq<<A as Array>::Item>, 

Removes consecutive duplicate elements.

pub fn dedup_by<F>(&mut self, same_bucket: F) where
    F: FnMut(&mut <A as Array>::Item, &mut <A as Array>::Item) -> bool

Removes consecutive duplicate elements using the given equality relation.

pub fn dedup_by_key<F, K>(&mut self, key: F) where
    F: FnMut(&mut <A as Array>::Item) -> K,
    K: PartialEq<K>, 

Removes consecutive elements that map to the same key.

pub fn resize_with<F>(&mut self, new_len: usize, f: F) where
    F: FnMut() -> <A as Array>::Item, 

Resizes the SmallVec in-place so that len is equal to new_len.

If new_len is greater than len, the SmallVec is extended by the difference, with each additional slot filled with the result of calling the closure f. The return values from f

If new_len is less than len, the SmallVec is simply truncated.

This method uses a closure to create new values on every push. If you'd rather Clone a given value, use resize. If you want to use the Default trait to generate values, you can pass Default::default() as the second argument.

Added for std::vec::Vec compatibility (added in Rust 1.33.0)

let mut vec : SmallVec<[_; 4]> = smallvec![1, 2, 3];
vec.resize_with(5, Default::default);
assert_eq!(&*vec, &[1, 2, 3, 0, 0]);

let mut vec : SmallVec<[_; 4]> = smallvec![];
let mut p = 1;
vec.resize_with(4, || { p *= 2; p });
assert_eq!(&*vec, &[2, 4, 8, 16]);

pub fn as_ptr(&self) -> *const <A as Array>::Item

Returns a raw pointer to the vector's buffer.

pub fn as_mut_ptr(&mut self) -> *mut <A as Array>::Item

Returns a raw mutable pointer to the vector's buffer.

pub fn insert_from_slice(&mut self, index: usize, slice: &[<A as Array>::Item])

Copy elements from a slice into the vector at position index, shifting any following elements toward the back.

For slices of Copy types, this is more efficient than insert.

pub fn extend_from_slice(&mut self, slice: &[<A as Array>::Item])

Copy elements from a slice and append them to the vector.

For slices of Copy types, this is more efficient than extend.

pub fn resize(&mut self, len: usize, value: <A as Array>::Item)

Resizes the vector so that its length is equal to len.

If len is less than the current length, the vector simply truncated.

If len is greater than the current length, value is appended to the vector until its length equals len.

Trait Implementations

impl Clone for Children[src]

impl Debug for Children[src]

impl Default for Children[src]

impl Deref for Children[src]

type Target = SmallVec<[Entity; 8]>

The resulting type after dereferencing.

impl DerefMut for Children[src]

impl DeserializeProperty for Children[src]

impl Properties for Children[src]

impl Property for Children[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Any for T where
    T: Any

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CloneAny for T where
    T: Clone + Any

impl<T> Component for T where
    T: 'static + Send + Sync

impl<T> Downcast for T where
    T: Any

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

impl<T> From<T> for T[src]

impl<T> FromResources for T where
    T: Default
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<P> PropertiesVal for P where
    P: Properties
[src]

impl<T> Resource for T where
    T: 'static + Send + Sync
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

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