Trait 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 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 Associated Types§

Source

type Axes: ArrayLength<Self::Component>

Number of axes

Source

type Component: Component

Type representing measured acceleration for a particular axis

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

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.

Implementors§

Source§

impl Vector for F32x2

Source§

const MIN: f32 = -3.40282347E+38f32

Source§

const MAX: f32 = 3.40282347E+38f32

Source§

type Component = f32

Source§

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

Source§

impl Vector for F32x3

Source§

const MIN: f32 = -3.40282347E+38f32

Source§

const MAX: f32 = 3.40282347E+38f32

Source§

type Component = f32

Source§

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

Source§

impl Vector for I8x2

Source§

const MIN: i8 = -128i8

Source§

const MAX: i8 = 127i8

Source§

type Component = i8

Source§

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

Source§

impl Vector for I8x3

Source§

const MIN: i8 = -128i8

Source§

const MAX: i8 = 127i8

Source§

type Component = i8

Source§

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

Source§

impl Vector for I16x2

Source§

const MIN: i16 = -32_768i16

Source§

const MAX: i16 = 32_767i16

Source§

type Component = i16

Source§

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

Source§

impl Vector for I16x3

Source§

const MIN: i16 = -32_768i16

Source§

const MAX: i16 = 32_767i16

Source§

type Component = i16

Source§

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

Source§

impl Vector for I32x2

Source§

const MIN: i32 = -2_147_483_648i32

Source§

const MAX: i32 = 2_147_483_647i32

Source§

type Component = i32

Source§

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

Source§

impl Vector for I32x3

Source§

const MIN: i32 = -2_147_483_648i32

Source§

const MAX: i32 = 2_147_483_647i32

Source§

type Component = i32

Source§

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

Source§

impl Vector for U8x2

Source§

const MIN: u8 = 0u8

Source§

const MAX: u8 = 255u8

Source§

type Component = u8

Source§

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

Source§

impl Vector for U8x3

Source§

const MIN: u8 = 0u8

Source§

const MAX: u8 = 255u8

Source§

type Component = u8

Source§

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

Source§

impl Vector for U16x2

Source§

const MIN: u16 = 0u16

Source§

const MAX: u16 = 65_535u16

Source§

type Component = u16

Source§

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

Source§

impl Vector for U16x3

Source§

const MIN: u16 = 0u16

Source§

const MAX: u16 = 65_535u16

Source§

type Component = u16

Source§

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

Source§

impl Vector for U32x2

Source§

const MIN: u32 = 0u32

Source§

const MAX: u32 = 4_294_967_295u32

Source§

type Component = u32

Source§

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

Source§

impl Vector for U32x3

Source§

const MIN: u32 = 0u32

Source§

const MAX: u32 = 4_294_967_295u32

Source§

type Component = u32

Source§

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