Struct rapier2d::geometry::ColliderSet[][src]

pub struct ColliderSet { /* fields omitted */ }

A set of colliders that can be handled by a physics World.

Implementations

impl ColliderSet[src]

pub fn new() -> Self[src]

Create a new empty set of colliders.

pub fn invalid_handle() -> ColliderHandle[src]

An always-invalid collider handle.

pub fn iter(&self) -> impl ExactSizeIterator<Item = (ColliderHandle, &Collider)>[src]

Iterate through all the colliders on this set.

pub fn iter_mut(
    &mut self
) -> impl Iterator<Item = (ColliderHandle, &mut Collider)>
[src]

Iterates mutably through all the colliders on this set.

pub fn len(&self) -> usize[src]

The number of colliders on this set.

pub fn is_empty(&self) -> bool[src]

true if there are no colliders in this set.

pub fn contains(&self, handle: ColliderHandle) -> bool[src]

Is this collider handle valid?

pub fn insert(
    &mut self,
    coll: Collider,
    parent_handle: RigidBodyHandle,
    bodies: &mut RigidBodySet
) -> ColliderHandle
[src]

Inserts a new collider to this set and retrieve its handle.

pub fn remove(
    &mut self,
    handle: ColliderHandle,
    bodies: &mut RigidBodySet,
    wake_up: bool
) -> Option<Collider>
[src]

Remove a collider from this set and update its parent accordingly.

If wake_up is true, the rigid-body the removed collider is attached to will be woken up.

pub fn get_unknown_gen(&self, i: usize) -> Option<(&Collider, ColliderHandle)>[src]

Gets the collider with the given handle without a known generation.

This is useful when you know you want the collider at position i but don’t know what is its current generation number. Generation numbers are used to protect from the ABA problem because the collider position i are recycled between two insertion and a removal.

Using this is discouraged in favor of self.get(handle) which does not suffer form the ABA problem.

pub fn get_unknown_gen_mut(
    &mut self,
    i: usize
) -> Option<(&mut Collider, ColliderHandle)>
[src]

Gets a mutable reference to the collider with the given handle without a known generation.

This is useful when you know you want the collider at position i but don’t know what is its current generation number. Generation numbers are used to protect from the ABA problem because the collider position i are recycled between two insertion and a removal.

Using this is discouraged in favor of self.get_mut(handle) which does not suffer form the ABA problem.

pub fn get(&self, handle: ColliderHandle) -> Option<&Collider>[src]

Get the collider with the given handle.

pub fn get_mut(&mut self, handle: ColliderHandle) -> Option<&mut Collider>[src]

Gets a mutable reference to the collider with the given handle.

Trait Implementations

impl Clone for ColliderSet[src]

impl Index<ColliderHandle> for ColliderSet[src]

type Output = Collider

The returned type after indexing.

impl IndexMut<ColliderHandle> for ColliderSet[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> Downcast for T where
    T: Any
[src]

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

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

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

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[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.