[][src]Trait accelerometer::vector::Vector

pub trait Vector: Copy + Debug + Default + Index<usize> + MulAssign<f32> + PartialEq + Sized + Send + Sync {
    type Component: Component;
    type Axes: ArrayLength<Self::Component>;

    const MIN: Self::Component;
    const MAX: Self::Component;

    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>; fn from_slice(slice: &[Self::Component]) -> Self { ... }
fn iter(&self) -> Iter<Self> { ... }
fn distance(self, other: Self) -> f32 { ... }
fn magnitude(self) -> f32 { ... } }

Vectors with numeric components

Associated Types

type Component: Component

Type representing measured acceleration for a particular axis

type Axes: ArrayLength<Self::Component>

Number of axes

Loading content...

Associated Constants

const MIN: Self::Component

Smallest value representable by a vector component

const MAX: Self::Component

Largest value representable by a vector component

Loading content...

Required methods

fn from_iter<I>(iter: I) -> Self where
    I: IntoIterator<Item = Self::Component>, 

Instantiate a Vector from an iterator over Self::Component values.

Panics of the iterator is not the correct length.

fn get(self, index: usize) -> Option<Self::Component>

Get the component value for a particular index

fn to_array(self) -> GenericArray<Self::Component, Self::Axes>

Obtain an array of the acceleration components for each of the axes

Loading content...

Provided methods

fn from_slice(slice: &[Self::Component]) -> Self

Instantiate a vector from a slice of components.

Panics if the slice is not the right size.

Important traits for Iter<'a, V>
fn iter(&self) -> Iter<Self>

Iterate over the components of a vector

fn distance(self, other: Self) -> f32

Compute the distance between two vectors

fn magnitude(self) -> f32

Compute the magnitude of a vector

Loading content...

Implementors

impl Vector for F32x2[src]

type Component = f32

type Axes = U2

fn from_slice(slice: &[Self::Component]) -> Self[src]

Important traits for Iter<'a, V>
fn iter(&self) -> Iter<Self>[src]

fn distance(self, other: Self) -> f32[src]

fn magnitude(self) -> f32[src]

impl Vector for F32x3[src]

type Component = f32

type Axes = U3

fn from_slice(slice: &[Self::Component]) -> Self[src]

Important traits for Iter<'a, V>
fn iter(&self) -> Iter<Self>[src]

fn distance(self, other: Self) -> f32[src]

fn magnitude(self) -> f32[src]

impl Vector for I16x2[src]

type Component = i16

type Axes = U2

fn from_slice(slice: &[Self::Component]) -> Self[src]

Important traits for Iter<'a, V>
fn iter(&self) -> Iter<Self>[src]

fn distance(self, other: Self) -> f32[src]

fn magnitude(self) -> f32[src]

impl Vector for I16x3[src]

type Component = i16

type Axes = U3

fn from_slice(slice: &[Self::Component]) -> Self[src]

Important traits for Iter<'a, V>
fn iter(&self) -> Iter<Self>[src]

fn distance(self, other: Self) -> f32[src]

fn magnitude(self) -> f32[src]

impl Vector for I8x2[src]

type Component = i8

type Axes = U2

fn from_slice(slice: &[Self::Component]) -> Self[src]

Important traits for Iter<'a, V>
fn iter(&self) -> Iter<Self>[src]

fn distance(self, other: Self) -> f32[src]

fn magnitude(self) -> f32[src]

impl Vector for I8x3[src]

type Component = i8

type Axes = U3

fn from_slice(slice: &[Self::Component]) -> Self[src]

Important traits for Iter<'a, V>
fn iter(&self) -> Iter<Self>[src]

fn distance(self, other: Self) -> f32[src]

fn magnitude(self) -> f32[src]

impl Vector for U16x2[src]

type Component = u16

type Axes = U2

fn from_slice(slice: &[Self::Component]) -> Self[src]

Important traits for Iter<'a, V>
fn iter(&self) -> Iter<Self>[src]

fn distance(self, other: Self) -> f32[src]

fn magnitude(self) -> f32[src]

impl Vector for U16x3[src]

type Component = u16

type Axes = U3

fn from_slice(slice: &[Self::Component]) -> Self[src]

Important traits for Iter<'a, V>
fn iter(&self) -> Iter<Self>[src]

fn distance(self, other: Self) -> f32[src]

fn magnitude(self) -> f32[src]

impl Vector for U8x2[src]

type Component = u8

type Axes = U2

fn from_slice(slice: &[Self::Component]) -> Self[src]

Important traits for Iter<'a, V>
fn iter(&self) -> Iter<Self>[src]

fn distance(self, other: Self) -> f32[src]

fn magnitude(self) -> f32[src]

impl Vector for U8x3[src]

type Component = u8

type Axes = U3

fn from_slice(slice: &[Self::Component]) -> Self[src]

Important traits for Iter<'a, V>
fn iter(&self) -> Iter<Self>[src]

fn distance(self, other: Self) -> f32[src]

fn magnitude(self) -> f32[src]

Loading content...