[][src]Struct amethyst_physics::objects::PhysicsGarbageCollector

pub struct PhysicsGarbageCollector {
    pub bodies: Vec<PhysicsRigidBodyTag>,
    pub areas: Vec<PhysicsAreaTag>,
    pub shapes: Vec<PhysicsShapeTag>,
    pub joints: Vec<PhysicsJointTag>,
}

This garbage collector is used to store all the PhysicsTags to whom its associated handle get dropped.

The main benefit to use the Garbage Collector is that each PhysicsServer can implement its own destructor pipeline. Another benefit is that the user can store the PhysicsHandles even as resource or as prefer.

The alternative implementation was use a flagged storage. Using a FlaggedStorage would have been not only less powerful (since the objects are not tracked if stored elsewhere), but even more complicate. Indeed the FlaggedStorage has an handy Event system, which returns only the storage Index of the associated event. What this mean in practice is that you don't have access to PhysicsTag ID because the Index get removed and the only way would have been re implement a new storage with the capability to return PhysicsTag on component drop. Also the destruction pipeline is dictated by amethyst_physics to each physics backend.

Considering the above the GC seems a better way.

Fields

bodies: Vec<PhysicsRigidBodyTag>

List of body no more used.

areas: Vec<PhysicsAreaTag>

List of areas no more used.

shapes: Vec<PhysicsShapeTag>

List of shapes no more used.

joints: Vec<PhysicsJointTag>

List of joints no mor used.

Trait Implementations

impl Default for PhysicsGarbageCollector[src]

impl Debug for PhysicsGarbageCollector[src]

Auto Trait Implementations

Blanket Implementations

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

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

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.

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

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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

impl<T> Any for T where
    T: Any

impl<T> Resource for T where
    T: Any + Send + Sync

impl<T> Event for T where
    T: Send + Sync + 'static, 

impl<T> TryDefault for T where
    T: Default