Struct lis2dh12::I16x3

source ·
pub struct I16x3 {
    pub x: i16,
    pub y: i16,
    pub z: i16,
}
Expand description

3-dimensional XYZ vector of i16 values

Fields§

§x: i16

X component

§y: i16

Y component

§z: i16

Z component

Implementations§

source§

impl I16x3

source

pub fn new(x: i16, y: i16, z: i16) -> I16x3

Instantiate from X,Y,Z components

Trait Implementations§

source§

impl Clone for I16x3

source§

fn clone(&self) -> I16x3

Returns a copy 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 Debug for I16x3

source§

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

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

impl Default for I16x3

source§

fn default() -> I16x3

Returns the “default value” for a type. Read more
source§

impl From<(i16, i16, i16)> for I16x3

source§

fn from(vector: (i16, i16, i16)) -> I16x3

Converts to this type from the input type.
source§

impl From<I16x3> for F32x3

source§

fn from(vector: I16x3) -> F32x3

Converts to this type from the input type.
source§

impl Index<usize> for I16x3

§

type Output = i16

The returned type after indexing.
source§

fn index(&self, i: usize) -> &i16

Performs the indexing (container[index]) operation. Read more
source§

impl MulAssign<f32> for I16x3

source§

fn mul_assign(&mut self, n: f32)

Performs the *= operation. Read more
source§

impl PartialEq for I16x3

source§

fn eq(&self, other: &I16x3) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<I2C, E> RawAccelerometer<I16x3> for Lis2dh12<I2C>
where I2C: WriteRead<Error = E> + Write<Error = E>, E: Debug,

source§

fn accel_raw(&mut self) -> Result<I16x3, Error<E>>

Get acceleration reading from the accelerometer

§

type Error = E

Error type
source§

impl Vector for I16x3

§

type Component = i16

Type representing measured acceleration for a particular axis
§

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

Number of axes
source§

const MIN: i16 = -32_768i16

Smallest value representable by a vector component
source§

const MAX: i16 = 32_767i16

Largest value representable by a vector component
source§

fn from_iter<I>(into_iter: I) -> I16x3
where I: IntoIterator<Item = <I16x3 as Vector>::Component>,

Instantiate a Vector from an iterator over Self::Component values. Read more
source§

fn get(self, i: usize) -> Option<<I16x3 as Vector>::Component>

Get the component value for a particular index
source§

fn to_array(self) -> GenericArray<i16, UInt<UInt<UTerm, B1>, B1>>

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

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

Instantiate a vector from a slice of components. Read more
source§

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

Iterate over the components of a vector
source§

impl Copy for I16x3

source§

impl StructuralPartialEq for I16x3

Auto Trait Implementations§

§

impl RefUnwindSafe for I16x3

§

impl Send for I16x3

§

impl Sync for I16x3

§

impl Unpin for I16x3

§

impl UnwindSafe for I16x3

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> 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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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.
source§

impl<V, A, C> VectorExt for V
where V: Vector<Axes = A, Component = C> + MulAssign<f32>, A: ArrayLength<C>, C: Component + Into<f32>,

source§

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

Compute the distance between two vectors

source§

fn magnitude(self) -> f32

Compute the magnitude of a vector