[][src]Trait nphysics2d::joint::JointConstraintSet

pub trait JointConstraintSet<N: RealField, Handle: BodyHandle> {
    type JointConstraint: ?Sized + JointConstraint<N, Handle>;
    type Handle: Copy;
    fn get(&self, handle: Self::Handle) -> Option<&Self::JointConstraint>;
fn get_mut(
        &mut self,
        handle: Self::Handle
    ) -> Option<&mut Self::JointConstraint>;
fn contains(&self, handle: Self::Handle) -> bool;
fn foreach(&self, f: impl FnMut(Self::Handle, &Self::JointConstraint));
fn foreach_mut(
        &mut self,
        f: impl FnMut(Self::Handle, &mut Self::JointConstraint)
    );
fn pop_insertion_event(
        &mut self
    ) -> Option<(Self::Handle, BodyPartHandle<Handle>, BodyPartHandle<Handle>)>;
fn pop_removal_event(
        &mut self
    ) -> Option<(Self::Handle, BodyPartHandle<Handle>, BodyPartHandle<Handle>)>;
fn remove(&mut self, to_remove: Self::Handle); }

Trait implemented by sets of constraint-based joints.

A set of constraint-based joints maps a joint handle to a joint instance. In addition, it must maintain a set of joint handle of joints that have been inserted removed (see the pop_insertion_event and pop_removal_event methods for details).

Associated Types

type JointConstraint: ?Sized + JointConstraint<N, Handle>

Type of a constraint-based joints stored in this set.

type Handle: Copy

Type of a joint handle identifying a joint in this set.

Loading content...

Required methods

fn get(&self, handle: Self::Handle) -> Option<&Self::JointConstraint>

Gets a reference to the joint identified by handle.

fn get_mut(
    &mut self,
    handle: Self::Handle
) -> Option<&mut Self::JointConstraint>

Gets a mutable reference to the joint identified by handle.

fn contains(&self, handle: Self::Handle) -> bool

Check if this set contains a joint identified by handle.

fn foreach(&self, f: impl FnMut(Self::Handle, &Self::JointConstraint))

Iterate through all the bodies on this set, applying the closure f on them.

fn foreach_mut(
    &mut self,
    f: impl FnMut(Self::Handle, &mut Self::JointConstraint)
)

Mutable iterates through all the bodies on this set, applying the closure f on them.

fn pop_insertion_event(
    &mut self
) -> Option<(Self::Handle, BodyPartHandle<Handle>, BodyPartHandle<Handle>)>

Gets the handle of one joint that has been inserted.

A joint set must keep track (using typically a stack or a queue) of every joint that has been inserted into it. This is used by nphysics to perform some internal setup actions, or physical actions like waking bodies attached to this joint.

This method should return a removed joint handle only once.

fn pop_removal_event(
    &mut self
) -> Option<(Self::Handle, BodyPartHandle<Handle>, BodyPartHandle<Handle>)>

Gets the handle of one joint that has been removed.

A joint set must keep track (using typically a stack or a queue) of every joint that has been removed from it. This is used by nphysics to perform some internal cleanup actions, or physical actions like waking bodies that were attached to this joint.

fn remove(&mut self, to_remove: Self::Handle)

Remove a joint from this set.

A constraint-based joint can be removed automatically by nphysics when one of its attached bodies is removed from the mechanical world.

Loading content...

Implementors

impl<N: RealField, Handle: BodyHandle> JointConstraintSet<N, Handle> for DefaultJointConstraintSet<N, Handle>[src]

type JointConstraint = dyn JointConstraint<N, Handle>

type Handle = DefaultJointConstraintHandle

Loading content...