pub struct DefaultBodySet<N>{ /* private fields */ }Expand description
The default set containing all the bodies added to the world.
It is based on an arena using generational indices to avoid the ABA problem.
Implementations§
Source§impl<N> DefaultBodySet<N>
impl<N> DefaultBodySet<N>
Sourcepub fn new() -> DefaultBodySet<N>
pub fn new() -> DefaultBodySet<N>
Creates an empty set.
Sourcepub fn insert_boxed(&mut self, body: Box<dyn Body<N>>) -> Index
pub fn insert_boxed(&mut self, body: Box<dyn Body<N>>) -> Index
Adds a body (represented as a boxed trait-object) to this set.
Sourcepub fn remove(&mut self, to_remove: Index) -> Option<Box<dyn Body<N>>>
pub fn remove(&mut self, to_remove: Index) -> Option<Box<dyn Body<N>>>
Removes a body from this set.
Sourcepub fn get(&self, handle: Index) -> Option<&(dyn Body<N> + 'static)>
pub fn get(&self, handle: Index) -> Option<&(dyn Body<N> + 'static)>
Gets a reference to the body identified by handle.
Sourcepub fn get_mut(&mut self, handle: Index) -> Option<&mut (dyn Body<N> + 'static)>
pub fn get_mut(&mut self, handle: Index) -> Option<&mut (dyn Body<N> + 'static)>
Gets a mutable reference to the body identified by handle.
Sourcepub fn iter(&self) -> impl Iterator<Item = (Index, &(dyn Body<N> + 'static))>
pub fn iter(&self) -> impl Iterator<Item = (Index, &(dyn Body<N> + 'static))>
Iterate through all the bodies and their handles.
Sourcepub fn iter_mut(
&mut self,
) -> impl Iterator<Item = (Index, &mut (dyn Body<N> + 'static))>
pub fn iter_mut( &mut self, ) -> impl Iterator<Item = (Index, &mut (dyn Body<N> + 'static))>
Mutably iterate through all the bodies and their handles.
Sourcepub fn rigid_body(&self, handle: Index) -> Option<&RigidBody<N>>
pub fn rigid_body(&self, handle: Index) -> Option<&RigidBody<N>>
Gets the rigid body identified by handle.
Returns None if the body does not exists, of if it exists but is not a rigid body.
Sourcepub fn rigid_body_mut(&mut self, handle: Index) -> Option<&mut RigidBody<N>>
pub fn rigid_body_mut(&mut self, handle: Index) -> Option<&mut RigidBody<N>>
Gets a mutable reference to the rigid body identified by handle.
Returns None if the body does not exists, of if it exists but is not a rigid body.
Sourcepub fn multibody(&self, handle: Index) -> Option<&Multibody<N>>
pub fn multibody(&self, handle: Index) -> Option<&Multibody<N>>
Gets the multibody identified by handle.
Returns None if the body does not exists, of if it exists but is not a multibody.
Sourcepub fn multibody_mut(&mut self, handle: Index) -> Option<&mut Multibody<N>>
pub fn multibody_mut(&mut self, handle: Index) -> Option<&mut Multibody<N>>
Gets a mutable reference to the multibody identified by handle.
Returns None if the body does not exists, of if it exists but is not a multibody.
Trait Implementations§
Source§impl<N> BodySet<N> for DefaultBodySet<N>
impl<N> BodySet<N> for DefaultBodySet<N>
Source§fn get(
&self,
handle: <DefaultBodySet<N> as BodySet<N>>::Handle,
) -> Option<&(dyn Body<N> + 'static)>
fn get( &self, handle: <DefaultBodySet<N> as BodySet<N>>::Handle, ) -> Option<&(dyn Body<N> + 'static)>
handle.Source§fn get_mut(
&mut self,
handle: <DefaultBodySet<N> as BodySet<N>>::Handle,
) -> Option<&mut (dyn Body<N> + 'static)>
fn get_mut( &mut self, handle: <DefaultBodySet<N> as BodySet<N>>::Handle, ) -> Option<&mut (dyn Body<N> + 'static)>
handle.Source§fn contains(&self, handle: <DefaultBodySet<N> as BodySet<N>>::Handle) -> bool
fn contains(&self, handle: <DefaultBodySet<N> as BodySet<N>>::Handle) -> bool
handle.Source§fn foreach(
&self,
f: &mut dyn FnMut(<DefaultBodySet<N> as BodySet<N>>::Handle, &(dyn Body<N> + 'static)),
)
fn foreach( &self, f: &mut dyn FnMut(<DefaultBodySet<N> as BodySet<N>>::Handle, &(dyn Body<N> + 'static)), )
f on them.Source§fn foreach_mut(
&mut self,
f: &mut dyn FnMut(<DefaultBodySet<N> as BodySet<N>>::Handle, &mut (dyn Body<N> + 'static)),
)
fn foreach_mut( &mut self, f: &mut dyn FnMut(<DefaultBodySet<N> as BodySet<N>>::Handle, &mut (dyn Body<N> + 'static)), )
f on them.Source§fn pop_removal_event(
&mut self,
) -> Option<<DefaultBodySet<N> as BodySet<N>>::Handle>
fn pop_removal_event( &mut self, ) -> Option<<DefaultBodySet<N> as BodySet<N>>::Handle>
Auto Trait Implementations§
impl<N> Freeze for DefaultBodySet<N>
impl<N> !RefUnwindSafe for DefaultBodySet<N>
impl<N> Send for DefaultBodySet<N>
impl<N> Sync for DefaultBodySet<N>
impl<N> Unpin for DefaultBodySet<N>
impl<N> UnsafeUnpin for DefaultBodySet<N>
impl<N> !UnwindSafe for DefaultBodySet<N>
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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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.