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§

source

type Axes: ArrayLength<Self::Component>

Number of axes

source

type Component: Component

Type representing measured acceleration for a particular axis

Required Associated Constants§

source

const MIN: Self::Component

Smallest value representable by a vector component

source

const MAX: Self::Component

Largest value representable by a vector component

Required Methods§

source

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.

source

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

Get the component value for a particular index

source

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

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

Provided Methods§

source

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

Instantiate a vector from a slice of components.

Panics if the slice is not the right size.

source

fn iter(&self) -> Iter<'_, Self>

Iterate over the components of a vector

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Vector for F32x2

§

type Component = f32

§

type Axes = UInt<UInt<UTerm, B1>, B0>

source§

const MIN: f32 = -3.40282347E+38f32

source§

const MAX: f32 = 3.40282347E+38f32

source§

impl Vector for F32x3

§

type Component = f32

§

type Axes = UInt<UInt<UTerm, B1>, B1>

source§

const MIN: f32 = -3.40282347E+38f32

source§

const MAX: f32 = 3.40282347E+38f32

source§

impl Vector for I8x2

§

type Component = i8

§

type Axes = UInt<UInt<UTerm, B1>, B0>

source§

const MIN: i8 = -128i8

source§

const MAX: i8 = 127i8

source§

impl Vector for I8x3

§

type Component = i8

§

type Axes = UInt<UInt<UTerm, B1>, B1>

source§

const MIN: i8 = -128i8

source§

const MAX: i8 = 127i8

source§

impl Vector for I16x2

§

type Component = i16

§

type Axes = UInt<UInt<UTerm, B1>, B0>

source§

const MIN: i16 = -32_768i16

source§

const MAX: i16 = 32_767i16

source§

impl Vector for I16x3

§

type Component = i16

§

type Axes = UInt<UInt<UTerm, B1>, B1>

source§

const MIN: i16 = -32_768i16

source§

const MAX: i16 = 32_767i16

source§

impl Vector for I32x2

§

type Component = i32

§

type Axes = UInt<UInt<UTerm, B1>, B0>

source§

const MIN: i32 = -2_147_483_648i32

source§

const MAX: i32 = 2_147_483_647i32

source§

impl Vector for I32x3

§

type Component = i32

§

type Axes = UInt<UInt<UTerm, B1>, B1>

source§

const MIN: i32 = -2_147_483_648i32

source§

const MAX: i32 = 2_147_483_647i32

source§

impl Vector for U8x2

§

type Component = u8

§

type Axes = UInt<UInt<UTerm, B1>, B0>

source§

const MIN: u8 = 0u8

source§

const MAX: u8 = 255u8

source§

impl Vector for U8x3

§

type Component = u8

§

type Axes = UInt<UInt<UTerm, B1>, B1>

source§

const MIN: u8 = 0u8

source§

const MAX: u8 = 255u8

source§

impl Vector for U16x2

§

type Component = u16

§

type Axes = UInt<UInt<UTerm, B1>, B0>

source§

const MIN: u16 = 0u16

source§

const MAX: u16 = 65_535u16

source§

impl Vector for U16x3

§

type Component = u16

§

type Axes = UInt<UInt<UTerm, B1>, B1>

source§

const MIN: u16 = 0u16

source§

const MAX: u16 = 65_535u16

source§

impl Vector for U32x2

§

type Component = u32

§

type Axes = UInt<UInt<UTerm, B1>, B0>

source§

const MIN: u32 = 0u32

source§

const MAX: u32 = 4_294_967_295u32

source§

impl Vector for U32x3

§

type Component = u32

§

type Axes = UInt<UInt<UTerm, B1>, B1>

source§

const MIN: u32 = 0u32

source§

const MAX: u32 = 4_294_967_295u32