Struct static_math::vector5::V5[][src]

pub struct V5<T>(_);

Implementations

impl<T> V5<T>[src]

pub fn new(input: [T; 5]) -> Self[src]

create a new V5 from a static array

pub fn new_from(a: T, b: T, c: T, d: T, e: T) -> Self[src]

create a new V5 from numbers

impl<T: Num + Copy> V5<T>[src]

pub fn zeros() -> Self[src]

create a V5 with all elements zeros

pub fn ones() -> Self[src]

create a V5 with all elements one

impl<T: Num + Copy + PartialOrd> V5<T>[src]

pub fn norm_inf(&self) -> T[src]

impl<T: Num + Copy + Signed + Sum> V5<T>[src]

pub fn norm_l(&self) -> T[src]

impl<T: Float> V5<T>[src]

pub fn norm2(&self) -> T[src]

calculate the euclidean norm of the V5

pub fn normalize(&mut self) -> Result<Self, VectorErrors>[src]

normalize the current V5 and return a new one

Methods from Deref<Target = [T; 5]>

pub fn as_slice(&self) -> &[T][src]

🔬 This is a nightly-only experimental API. (array_methods)

Returns a slice containing the entire array. Equivalent to &s[..].

pub fn as_mut_slice(&mut self) -> &mut [T][src]

🔬 This is a nightly-only experimental API. (array_methods)

Returns a mutable slice containing the entire array. Equivalent to &mut s[..].

pub fn each_ref(&self) -> [&T; N][src]

🔬 This is a nightly-only experimental API. (array_methods)

Borrows each element and returns an array of references with the same size as self.

Example

#![feature(array_methods)]

let floats = [3.1, 2.7, -1.0];
let float_refs: [&f64; 3] = floats.each_ref();
assert_eq!(float_refs, [&3.1, &2.7, &-1.0]);

This method is particularly useful if combined with other methods, like map. This way, you can avoid moving the original array if its elements are not Copy.

#![feature(array_methods, array_map)]

let strings = ["Ferris".to_string(), "♥".to_string(), "Rust".to_string()];
let is_ascii = strings.each_ref().map(|s| s.is_ascii());
assert_eq!(is_ascii, [true, false, true]);

// We can still access the original array: it has not been moved.
assert_eq!(strings.len(), 3);

pub fn each_mut(&mut self) -> [&mut T; N][src]

🔬 This is a nightly-only experimental API. (array_methods)

Borrows each element mutably and returns an array of mutable references with the same size as self.

Example

#![feature(array_methods)]

let mut floats = [3.1, 2.7, -1.0];
let float_refs: [&mut f64; 3] = floats.each_mut();
*float_refs[0] = 0.0;
assert_eq!(float_refs, [&mut 0.0, &mut 2.7, &mut -1.0]);
assert_eq!(floats, [0.0, 2.7, -1.0]);

Trait Implementations

impl<T: Num + Copy> Add<V5<T>> for V5<T>[src]

type Output = Self

The resulting type after applying the + operator.

fn add(self, rhs: Self) -> Self[src]

Performs the + operation. Read more

impl<T: Num + Copy> AddAssign<V5<T>> for V5<T>[src]

fn add_assign(&mut self, other: Self)[src]

Performs the += operation. Read more

impl<T: Clone> Clone for V5<T>[src]

fn clone(&self) -> V5<T>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<T: Debug> Debug for V5<T>[src]

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

Formats the value using the given formatter. Read more

impl<T> Deref for V5<T>[src]

type Target = [T; 5]

The resulting type after dereferencing.

fn deref(&self) -> &Self::Target[src]

Dereferences the value.

impl<T> DerefMut for V5<T>[src]

fn deref_mut(&mut self) -> &mut Self::Target[src]

Mutably dereferences the value.

impl<T: Num + Display> Display for V5<T>[src]

fn fmt(&self, dest: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<T: Num + Copy> Div<T> for V5<T>[src]

type Output = Self

The resulting type after applying the / operator.

fn div(self, rhs: T) -> Self::Output[src]

Performs the / operation. Read more

impl<T> From<[T; 5]> for V5<T>[src]

fn from(data: [T; 5]) -> V5<T>[src]

Performs the conversion.

impl<T: Num + Copy> Mul<M55<T>> for V5<T>[src]

type Output = V5<T>

The resulting type after applying the * operator.

fn mul(self, rhs: M55<T>) -> V5<T>[src]

Performs the * operation. Read more

impl<T: Num + Copy> Mul<T> for V5<T>[src]

type Output = V5<T>

The resulting type after applying the * operator.

fn mul(self, rhs: T) -> V5<T>[src]

Performs the * operation. Read more

impl<T: Num + Copy> Mul<V5<T>> for M55<T>[src]

type Output = V5<T>

The resulting type after applying the * operator.

fn mul(self, rhs: V5<T>) -> V5<T>[src]

Performs the * operation. Read more

impl<T: Num + Copy> Mul<V5<T>> for V5<T>[src]

type Output = T

The resulting type after applying the * operator.

fn mul(self, rhs: Self) -> T[src]

Performs the * operation. Read more

impl<T: Num + Copy + Signed> Neg for V5<T>[src]

type Output = Self

The resulting type after applying the - operator.

fn neg(self) -> Self[src]

Performs the unary - operation. Read more

impl<T: PartialEq> PartialEq<V5<T>> for V5<T>[src]

fn eq(&self, other: &V5<T>) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &V5<T>) -> bool[src]

This method tests for !=.

impl<T: Num + Copy> Sub<V5<T>> for V5<T>[src]

type Output = Self

The resulting type after applying the - operator.

fn sub(self, rhs: Self) -> Self[src]

Performs the - operation. Read more

impl<T: Num + Copy> SubAssign<V5<T>> for V5<T>[src]

fn sub_assign(&mut self, other: Self)[src]

Performs the -= operation. Read more

impl<T: Num + Copy> Zero for V5<T>[src]

fn zero() -> V5<T>[src]

Returns the additive identity element of Self, 0. Read more

fn is_zero(&self) -> bool[src]

Returns true if self is equal to the additive identity.

fn set_zero(&mut self)[src]

Sets self to the additive identity element of Self, 0.

impl<T: Copy> Copy for V5<T>[src]

impl<T> StructuralPartialEq for V5<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for V5<T> where
    T: RefUnwindSafe

impl<T> Send for V5<T> where
    T: Send

impl<T> Sync for V5<T> where
    T: Sync

impl<T> Unpin for V5<T> where
    T: Unpin

impl<T> UnwindSafe for V5<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T> ToString for T where
    T: Display + ?Sized
[src]

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.