Struct ncollide2d::world::CollisionObjectSlab
source · pub struct CollisionObjectSlab<N: Real, T> { /* private fields */ }
Expand description
A set of collision objects that can be indexed by collision object handles.
Implementations§
source§impl<N: Real, T> CollisionObjectSlab<N, T>
impl<N: Real, T> CollisionObjectSlab<N, T>
sourcepub fn new() -> CollisionObjectSlab<N, T>
pub fn new() -> CollisionObjectSlab<N, T>
Creates a new empty collecton of collision objects.
sourcepub fn insert(&mut self, co: CollisionObject<N, T>) -> CollisionObjectHandle
pub fn insert(&mut self, co: CollisionObject<N, T>) -> CollisionObjectHandle
Inserts a new collision object into this collection and returns the corresponding handle.
sourcepub fn remove(&mut self, handle: CollisionObjectHandle) -> CollisionObject<N, T>
pub fn remove(&mut self, handle: CollisionObjectHandle) -> 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: CollisionObjectHandle
) -> Option<&CollisionObject<N, T>>
pub fn get(
&self,
handle: CollisionObjectHandle
) -> 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: CollisionObjectHandle
) -> Option<&mut CollisionObject<N, T>>
pub fn get_mut(
&mut self,
handle: CollisionObjectHandle
) -> Option<&mut CollisionObject<N, T>>
If it exists, retrieves a mutable reference to the collision object identified by the given handle.
sourcepub fn contains(&self, handle: CollisionObjectHandle) -> bool
pub fn contains(&self, handle: CollisionObjectHandle) -> 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.
Trait Implementations§
source§impl<N: Real, T> Index<CollisionObjectHandle> for CollisionObjectSlab<N, T>
impl<N: Real, T> Index<CollisionObjectHandle> for CollisionObjectSlab<N, T>
§type Output = CollisionObject<N, T>
type Output = CollisionObject<N, T>
The returned type after indexing.
source§impl<N: Real, T> IndexMut<CollisionObjectHandle> for CollisionObjectSlab<N, T>
impl<N: Real, T> IndexMut<CollisionObjectHandle> for CollisionObjectSlab<N, T>
Auto Trait Implementations§
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
N: Unpin,
T: Unpin,
impl<N, T> !UnwindSafe for CollisionObjectSlab<N, T>
Blanket Implementations§
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>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe 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
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.