Struct ncollide2d::pipeline::object::CollisionObjectSlab
source · [−]Expand description
A set of collision objects that can be indexed by collision object handles.
Implementations
sourceimpl<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>ⓘNotable traits for CollisionObjects<'a, N, T>impl<'a, N: 'a + RealField + Copy, T: 'a> Iterator for CollisionObjects<'a, N, T> type Item = (CollisionObjectSlabHandle, &'a CollisionObject<N, T>);
pub fn iter(&self) -> CollisionObjects<'_, N, T>ⓘNotable traits for CollisionObjects<'a, N, T>impl<'a, N: 'a + RealField + Copy, T: 'a> Iterator for CollisionObjects<'a, N, T> type Item = (CollisionObjectSlabHandle, &'a CollisionObject<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
sourceimpl<N: RealField + Copy, T> CollisionObjectSet<N> for CollisionObjectSlab<N, T>
impl<N: RealField + Copy, T> CollisionObjectSet<N> for CollisionObjectSlab<N, T>
type CollisionObject = CollisionObject<N, T>
type CollisionObject = CollisionObject<N, T>
Type of the collision object stored into this set.
type CollisionObjectHandle = CollisionObjectSlabHandle
type CollisionObjectHandle = CollisionObjectSlabHandle
Type of the handles identifying collision objects.
sourcefn collision_object(
&self,
handle: Self::CollisionObjectHandle
) -> Option<&Self::CollisionObject>
fn collision_object(
&self,
handle: Self::CollisionObjectHandle
) -> Option<&Self::CollisionObject>
Gets the collision object identified by the given handle
.
sourcefn foreach(
&self,
f: impl FnMut(Self::CollisionObjectHandle, &Self::CollisionObject)
)
fn foreach(
&self,
f: impl FnMut(Self::CollisionObjectHandle, &Self::CollisionObject)
)
Applies a closure to every collision object (and their handle) stored into this set.
sourceimpl<N: RealField + Copy, T> Index<CollisionObjectSlabHandle> for CollisionObjectSlab<N, T>
impl<N: RealField + Copy, T> Index<CollisionObjectSlabHandle> for CollisionObjectSlab<N, T>
type Output = CollisionObject<N, T>
type Output = CollisionObject<N, T>
The returned type after indexing.
sourcefn index(&self, handle: CollisionObjectSlabHandle) -> &Self::Output
fn index(&self, handle: CollisionObjectSlabHandle) -> &Self::Output
Performs the indexing (container[index]
) operation. Read more
sourceimpl<N: RealField + Copy, T> IndexMut<CollisionObjectSlabHandle> for CollisionObjectSlab<N, T>
impl<N: RealField + Copy, T> IndexMut<CollisionObjectSlabHandle> for CollisionObjectSlab<N, T>
sourcefn index_mut(&mut self, handle: CollisionObjectSlabHandle) -> &mut Self::Output
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> !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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CheckedAs for T
impl<T> CheckedAs for T
sourcefn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
sourcefn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
sourceimpl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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
. Read more
sourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcefn as_any(&self) -> &(dyn Any + 'static)
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. Read more
sourcefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
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. Read more
sourceimpl<T> DowncastSync for T where
T: Any + Send + Sync,
impl<T> DowncastSync for T where
T: Any + Send + Sync,
sourceimpl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>,
sourcefn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Performs the conversion.
sourceimpl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
sourcefn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Performs the conversion.
sourceimpl<T> OverflowingAs for T
impl<T> OverflowingAs for T
sourcefn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
sourcefn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
OverflowingCasts the value.
sourceimpl<T> SaturatingAs for T
impl<T> SaturatingAs for T
sourcefn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
sourcefn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
sourceimpl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
sourcefn 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 more
sourcefn 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).
sourcefn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
sourcefn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.
sourceimpl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
sourcefn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
sourcefn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
UnwrappedCasts the value.
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WrappingAs for T
impl<T> WrappingAs for T
sourcefn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
sourcefn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
WrappingCasts the value.