Skip to main content

SpringCollection

Struct SpringCollection 

Source
pub struct SpringCollection<F, const N: usize> { /* private fields */ }
Expand description

A fixed-size collection of springs that all share the same spring parameters. Useful for creating springs over multiple dimensions (i.e. 2D or 3D springs).

Implementations§

Source§

impl<F: Float, const N: usize> SpringCollection<F, N>

Source

pub fn from_equilibrium( params: impl Into<SpringParams<F>>, equilibrium: F, ) -> Self

Construct N springs, all starting at a specified equilibrium.

Source

pub fn from_equilibriums( params: impl Into<SpringParams<F>>, equilibriums: [F; N], ) -> Self

Construct N springs, each with a particular equilibrium.

Source

pub fn update(&mut self, delta: F)

Update all springs over the specified delta. Constructs a new SpringTimeStep for this usage.

Source

pub fn update_with(&mut self, time_step: SpringTimeStep<F>)

Update all springs using the specified time_step.

Note: this time step need not be derived from SpringCollection::params. The implementation of this method uses all constants from time_step.

Source§

impl<F: Float, const N: usize> SpringCollection<F, N>

Source

pub fn positions(&self) -> &[F; N]

The array of current spring $plural.

Source

pub fn positions_mut(&mut self) -> &mut [F; N]

Mutable reference of current spring positions.

Source§

impl<F: Float, const N: usize> SpringCollection<F, N>

Source

pub fn velocities(&self) -> &[F; N]

The array of current spring $plural.

Source

pub fn velocities_mut(&mut self) -> &mut [F; N]

Mutable reference of current spring velocities.

Source§

impl<F: Float, const N: usize> SpringCollection<F, N>

Source

pub fn equilibriums(&self) -> &[F; N]

The array of current spring $plural.

Source

pub fn equilibriums_mut(&mut self) -> &mut [F; N]

Mutable reference of current spring equilibriums.

Trait Implementations§

Source§

impl<F: Clone, const N: usize> Clone for SpringCollection<F, N>

Source§

fn clone(&self) -> SpringCollection<F, N>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<F: Debug, const N: usize> Debug for SpringCollection<F, N>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<F: Float, const N: usize> From<SpringCollection<F, N>> for [Spring<F>; N]

Source§

fn from(value: SpringCollection<F, N>) -> Self

Converts to this type from the input type.
Source§

impl<F: Float, const N: usize, T> From<T> for SpringCollection<F, N>
where T: Into<SpringParams<F>>,

Source§

fn from(params: T) -> Self

Converts to this type from the input type.
Source§

impl<F: PartialEq, const N: usize> PartialEq for SpringCollection<F, N>

Source§

fn eq(&self, other: &SpringCollection<F, N>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<F, const N: usize> StructuralPartialEq for SpringCollection<F, N>

Auto Trait Implementations§

§

impl<F, const N: usize> Freeze for SpringCollection<F, N>
where F: Freeze,

§

impl<F, const N: usize> RefUnwindSafe for SpringCollection<F, N>
where F: RefUnwindSafe,

§

impl<F, const N: usize> Send for SpringCollection<F, N>
where F: Send,

§

impl<F, const N: usize> Sync for SpringCollection<F, N>
where F: Sync,

§

impl<F, const N: usize> Unpin for SpringCollection<F, N>
where F: Unpin,

§

impl<F, const N: usize> UnwindSafe for SpringCollection<F, N>
where F: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.