ncollide3d::pipeline::object

Struct CollisionObjectSlab

Source
pub struct CollisionObjectSlab<N: RealField + Copy, T> { /* private fields */ }
Expand description

A set of collision objects that can be indexed by collision object handles.

Implementations§

Source§

impl<N: RealField + Copy, T> CollisionObjectSlab<N, T>

Source

pub fn new() -> CollisionObjectSlab<N, T>

Creates a new empty collection of collision objects.

Source

pub fn with_capacity(capacity: usize) -> CollisionObjectSlab<N, T>

Constructs a new empty collection with the specified capacity.

Source

pub fn insert(&mut self, co: CollisionObject<N, T>) -> CollisionObjectSlabHandle

Inserts a new collision object into this collection and returns the corresponding handle.

Source

pub fn remove( &mut self, handle: CollisionObjectSlabHandle, ) -> CollisionObject<N, T>

Removes from this collection the collision object identified by the given handle.

The removed collision object structure is returned.

Source

pub fn get( &self, handle: CollisionObjectSlabHandle, ) -> Option<&CollisionObject<N, T>>

If it exists, retrieves a reference to the collision object identified by the given handle.

Source

pub fn get_mut( &mut self, handle: CollisionObjectSlabHandle, ) -> Option<&mut CollisionObject<N, T>>

If it exists, retrieves a mutable reference to the collision object identified by the given handle.

Source

pub fn get_pair_mut( &mut self, handle1: CollisionObjectSlabHandle, handle2: CollisionObjectSlabHandle, ) -> (Option<&mut CollisionObject<N, T>>, Option<&mut CollisionObject<N, T>>)

If they exists, retrieves a mutable reference to the two collision object identified by the given handles.

Panics if both handles are equal.

Source

pub fn contains(&self, handle: CollisionObjectSlabHandle) -> bool

Returns true if the specified handle identifies a collision object stored in this collection.

Source

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

Retrieves an iterator yielding references to each collision object.

Source

pub fn iter_mut(&mut self) -> CollisionObjectsMut<'_, N, T>

Retrieves an iterator yielding references to each collision object.

Source

pub fn len(&self) -> usize

The number of collision objects on this slab.

Source

pub fn capacity(&self) -> usize

Return the number of values the slab can store without reallocating.

Source

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

Reserve capacity for at least additional more values to be stored without allocating.

Source

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

Reserve the minimum capacity required to store exactly additional more values.

Trait Implementations§

Source§

impl<N: RealField + Copy, T> CollisionObjectSet<N> for CollisionObjectSlab<N, T>

Source§

type CollisionObject = CollisionObject<N, T>

Type of the collision object stored into this set.
Source§

type CollisionObjectHandle = CollisionObjectSlabHandle

Type of the handles identifying collision objects.
Source§

fn collision_object( &self, handle: Self::CollisionObjectHandle, ) -> Option<&Self::CollisionObject>

Gets the collision object identified by the given handle.
Source§

fn foreach( &self, f: impl FnMut(Self::CollisionObjectHandle, &Self::CollisionObject), )

Applies a closure to every collision object (and their handle) stored into this set.
Source§

impl<N: RealField + Copy, T> Index<CollisionObjectSlabHandle> for CollisionObjectSlab<N, T>

Source§

type Output = CollisionObject<N, T>

The returned type after indexing.
Source§

fn index(&self, handle: CollisionObjectSlabHandle) -> &Self::Output

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

impl<N: RealField + Copy, T> IndexMut<CollisionObjectSlabHandle> for CollisionObjectSlab<N, T>

Source§

fn index_mut(&mut self, handle: CollisionObjectSlabHandle) -> &mut Self::Output

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

Auto Trait Implementations§

§

impl<N, T> Freeze for CollisionObjectSlab<N, T>

§

impl<N, T> !RefUnwindSafe for CollisionObjectSlab<N, T>

§

impl<N, T> Send for CollisionObjectSlab<N, T>
where T: Send,

§

impl<N, T> Sync for CollisionObjectSlab<N, T>
where T: Sync,

§

impl<N, T> Unpin for CollisionObjectSlab<N, T>
where T: Unpin, N: Unpin,

§

impl<N, T> !UnwindSafe for CollisionObjectSlab<N, T>

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> Downcast for T
where T: Any,

Source§

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

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

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

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

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

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

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

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

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

Source§

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

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.