pub trait ForceGeneratorSet<N: RealField + Copy, Handle: BodyHandle> {
type ForceGenerator: ?Sized + ForceGenerator<N, Handle>;
type Handle: Copy;
// Required methods
fn get(&self, handle: Self::Handle) -> Option<&Self::ForceGenerator>;
fn get_mut(
&mut self,
handle: Self::Handle,
) -> Option<&mut Self::ForceGenerator>;
fn contains(&self, handle: Self::Handle) -> bool;
fn foreach(&self, f: impl FnMut(Self::Handle, &Self::ForceGenerator));
fn foreach_mut(
&mut self,
f: impl FnMut(Self::Handle, &mut Self::ForceGenerator),
);
}Expand description
Trait implemented by sets of force generators.
A set of bodies maps a force generator handle to a force generator instance.
Required Associated Types§
Sourcetype ForceGenerator: ?Sized + ForceGenerator<N, Handle>
type ForceGenerator: ?Sized + ForceGenerator<N, Handle>
Type of a force generator stored in this set.
Required Methods§
Sourcefn get(&self, handle: Self::Handle) -> Option<&Self::ForceGenerator>
fn get(&self, handle: Self::Handle) -> Option<&Self::ForceGenerator>
Gets a reference to the force generator identified by handle.
Sourcefn get_mut(&mut self, handle: Self::Handle) -> Option<&mut Self::ForceGenerator>
fn get_mut(&mut self, handle: Self::Handle) -> Option<&mut Self::ForceGenerator>
Gets a mutable reference to the force generator identified by handle.
Sourcefn contains(&self, handle: Self::Handle) -> bool
fn contains(&self, handle: Self::Handle) -> bool
Check if this set contains a force generator identified by handle.
Sourcefn foreach(&self, f: impl FnMut(Self::Handle, &Self::ForceGenerator))
fn foreach(&self, f: impl FnMut(Self::Handle, &Self::ForceGenerator))
Iterate through all the force generators on this set, applying the closure f on them.
Sourcefn foreach_mut(
&mut self,
f: impl FnMut(Self::Handle, &mut Self::ForceGenerator),
)
fn foreach_mut( &mut self, f: impl FnMut(Self::Handle, &mut Self::ForceGenerator), )
Mutable iterates through all the force generators on this set, applying the closure f on them.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.