Trait accelerometer::Vector
source · pub trait Vector: Sized + Copy + Debug + Default + Index<usize> + PartialEq + Send + Sync {
type Axes: ArrayLength<Self::Component>;
type Component: Component;
const MIN: Self::Component;
const MAX: Self::Component;
// Required methods
fn from_iter<I>(iter: I) -> Self
where I: IntoIterator<Item = Self::Component>;
fn get(self, index: usize) -> Option<Self::Component>;
fn to_array(self) -> GenericArray<Self::Component, Self::Axes>;
// Provided methods
fn from_slice(slice: &[Self::Component]) -> Self { ... }
fn iter(&self) -> Iter<'_, Self> ⓘ { ... }
}Expand description
Vectors with numeric components
Required Associated Types§
sourcetype Axes: ArrayLength<Self::Component>
type Axes: ArrayLength<Self::Component>
Number of axes
Required Associated Constants§
Required Methods§
sourcefn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = Self::Component>,
fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = Self::Component>,
Instantiate a Vector from an iterator over Self::Component values.
Panics of the iterator is not the correct length.
sourcefn get(self, index: usize) -> Option<Self::Component>
fn get(self, index: usize) -> Option<Self::Component>
Get the component value for a particular index
sourcefn to_array(self) -> GenericArray<Self::Component, Self::Axes>
fn to_array(self) -> GenericArray<Self::Component, Self::Axes>
Obtain an array of the acceleration components for each of the axes
Provided Methods§
sourcefn from_slice(slice: &[Self::Component]) -> Self
fn from_slice(slice: &[Self::Component]) -> Self
Instantiate a vector from a slice of components.
Panics if the slice is not the right size.
Object Safety§
This trait is not object safe.