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>
impl<N: RealField + Copy, T> CollisionObjectSlab<N, T>
Sourcepub fn new() -> CollisionObjectSlab<N, T>
pub fn new() -> CollisionObjectSlab<N, T>
Creates a new empty collection of collision objects.
Sourcepub fn with_capacity(capacity: usize) -> CollisionObjectSlab<N, T>
pub fn with_capacity(capacity: usize) -> CollisionObjectSlab<N, T>
Constructs a new empty collection with the specified capacity.
Sourcepub fn insert(&mut self, co: CollisionObject<N, T>) -> CollisionObjectSlabHandle
pub fn insert(&mut self, co: CollisionObject<N, T>) -> CollisionObjectSlabHandle
Inserts a new collision object into this collection and returns the corresponding handle.
Sourcepub fn remove(
&mut self,
handle: CollisionObjectSlabHandle,
) -> CollisionObject<N, T>
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.
Sourcepub fn get(
&self,
handle: CollisionObjectSlabHandle,
) -> Option<&CollisionObject<N, T>>
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.
Sourcepub fn get_mut(
&mut self,
handle: CollisionObjectSlabHandle,
) -> Option<&mut CollisionObject<N, T>>
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.
Sourcepub fn get_pair_mut(
&mut self,
handle1: CollisionObjectSlabHandle,
handle2: CollisionObjectSlabHandle,
) -> (Option<&mut CollisionObject<N, T>>, Option<&mut CollisionObject<N, T>>)
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.
Sourcepub fn contains(&self, handle: CollisionObjectSlabHandle) -> bool
pub fn contains(&self, handle: CollisionObjectSlabHandle) -> bool
Returns true
if the specified handle identifies a collision object stored in this collection.
Sourcepub fn iter(&self) -> CollisionObjects<'_, N, T> ⓘ
pub fn iter(&self) -> CollisionObjects<'_, N, T> ⓘ
Retrieves an iterator yielding references to each collision object.
Sourcepub fn iter_mut(&mut self) -> CollisionObjectsMut<'_, N, T>
pub fn iter_mut(&mut self) -> CollisionObjectsMut<'_, N, T>
Retrieves an iterator yielding references to each collision object.
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Return the number of values the slab can store without reallocating.
Sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserve capacity for at least additional
more values to be stored
without allocating.
Sourcepub fn reserve_exact(&mut self, additional: usize)
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>
impl<N: RealField + Copy, T> CollisionObjectSet<N> for CollisionObjectSlab<N, T>
Source§type CollisionObject = CollisionObject<N, T>
type CollisionObject = CollisionObject<N, T>
Source§type CollisionObjectHandle = CollisionObjectSlabHandle
type CollisionObjectHandle = CollisionObjectSlabHandle
Source§fn collision_object(
&self,
handle: Self::CollisionObjectHandle,
) -> Option<&Self::CollisionObject>
fn collision_object( &self, handle: Self::CollisionObjectHandle, ) -> Option<&Self::CollisionObject>
handle
.Source§fn foreach(
&self,
f: impl FnMut(Self::CollisionObjectHandle, &Self::CollisionObject),
)
fn foreach( &self, f: impl FnMut(Self::CollisionObjectHandle, &Self::CollisionObject), )
Source§impl<N: RealField + Copy, T> Index<CollisionObjectSlabHandle> for CollisionObjectSlab<N, T>
impl<N: RealField + Copy, T> Index<CollisionObjectSlabHandle> for CollisionObjectSlab<N, T>
Source§type Output = CollisionObject<N, T>
type Output = CollisionObject<N, T>
Source§impl<N: RealField + Copy, T> IndexMut<CollisionObjectSlabHandle> for CollisionObjectSlab<N, T>
impl<N: RealField + Copy, T> IndexMut<CollisionObjectSlabHandle> for CollisionObjectSlab<N, T>
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>
impl<N, T> !UnwindSafe for CollisionObjectSlab<N, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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
impl<T> DowncastSync for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.