Vec3

Struct Vec3 

Source
pub struct Vec3<T = f64> {
    pub x: T,
    pub y: T,
    pub z: T,
}
Expand description

A struct representing a three-dimensional mathematical vector. These are used to represent particle information, such as position or velocity, in three-dimensional space.

Fields§

§x: T§y: T§z: T

Implementations§

Source§

impl<T> Vec3<T>

Source

pub fn new(x: T, y: T, z: T) -> Self

Creates a new Vec3 instance with the given x, y, and z components.

§Example
use moldyn_core::Vec3;

let v: Vec3<f64> = Vec3::new(1.0, 2.0, 3.0);
let w: Vec3<i32> = Vec3::new(1, 2, 3);

assert_eq!(v.x, 1.0);
assert_eq!(v.y, 2.0);
assert_eq!(v.z, 3.0);
assert_eq!(w.x, 1);
assert_eq!(w.y, 2);
assert_eq!(w.z, 3);
Source

pub fn zero() -> Self
where T: Default,

Creates a new Vec3 instance with all components set to zero. Requires that the generic type implements the Default trait.

Source

pub fn map<U, F>(self, f: F) -> Vec3<U>
where F: Fn(T) -> U,

Maps the individual components of the Vec3 instance to a new type with the provided lambda expression.

Source§

impl Vec3<u8>

Source

pub fn dot(&self, other: &Self) -> u8

Creates the dot product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn cross(&self, other: &Self) -> Self

Creates the cross product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn length(&self) -> f64

Computes the length (magnitude) of the Vec3 instance.

§Example
use moldyn_core::Vec3;

let v : Vec3 < u8 > = Vec3 :: < u8 > :: new(2.0 as u8, 2.0 as u8, 1.0 as u8);

assert_eq!(v.length(), 3.0);
Source

pub fn length2(&self) -> u8

TODO: rethink: old codebase became buggy because we used the wrong method.

Source

pub fn normal(&self) -> Option<Self>

Normalizes the Vec3 instance to have a length of 1, returning an option containing a new Vec3 instance. If the original vector is zero-length, returns None to avoid division by zero.

Note: I’ve made this decision with the intention of propagating divisions by zero upwards the stack. I do not know if this will turn out to be useful.

Source§

impl Vec3<u16>

Source

pub fn dot(&self, other: &Self) -> u16

Creates the dot product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn cross(&self, other: &Self) -> Self

Creates the cross product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn length(&self) -> f64

Computes the length (magnitude) of the Vec3 instance.

§Example
use moldyn_core::Vec3;

let v : Vec3 < u16 > = Vec3 :: < u16 > ::
new(2.0 as u16, 2.0 as u16, 1.0 as u16);

assert_eq!(v.length(), 3.0);
Source

pub fn length2(&self) -> u16

TODO: rethink: old codebase became buggy because we used the wrong method.

Source

pub fn normal(&self) -> Option<Self>

Normalizes the Vec3 instance to have a length of 1, returning an option containing a new Vec3 instance. If the original vector is zero-length, returns None to avoid division by zero.

Note: I’ve made this decision with the intention of propagating divisions by zero upwards the stack. I do not know if this will turn out to be useful.

Source§

impl Vec3<u32>

Source

pub fn dot(&self, other: &Self) -> u32

Creates the dot product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn cross(&self, other: &Self) -> Self

Creates the cross product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn length(&self) -> f64

Computes the length (magnitude) of the Vec3 instance.

§Example
use moldyn_core::Vec3;

let v : Vec3 < u32 > = Vec3 :: < u32 > ::
new(2.0 as u32, 2.0 as u32, 1.0 as u32);

assert_eq!(v.length(), 3.0);
Source

pub fn length2(&self) -> u32

TODO: rethink: old codebase became buggy because we used the wrong method.

Source

pub fn normal(&self) -> Option<Self>

Normalizes the Vec3 instance to have a length of 1, returning an option containing a new Vec3 instance. If the original vector is zero-length, returns None to avoid division by zero.

Note: I’ve made this decision with the intention of propagating divisions by zero upwards the stack. I do not know if this will turn out to be useful.

Source§

impl Vec3<u64>

Source

pub fn dot(&self, other: &Self) -> u64

Creates the dot product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn cross(&self, other: &Self) -> Self

Creates the cross product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn length(&self) -> f64

Computes the length (magnitude) of the Vec3 instance.

§Example
use moldyn_core::Vec3;

let v : Vec3 < u64 > = Vec3 :: < u64 > ::
new(2.0 as u64, 2.0 as u64, 1.0 as u64);

assert_eq!(v.length(), 3.0);
Source

pub fn length2(&self) -> u64

TODO: rethink: old codebase became buggy because we used the wrong method.

Source

pub fn normal(&self) -> Option<Self>

Normalizes the Vec3 instance to have a length of 1, returning an option containing a new Vec3 instance. If the original vector is zero-length, returns None to avoid division by zero.

Note: I’ve made this decision with the intention of propagating divisions by zero upwards the stack. I do not know if this will turn out to be useful.

Source§

impl Vec3<u128>

Source

pub fn dot(&self, other: &Self) -> u128

Creates the dot product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn cross(&self, other: &Self) -> Self

Creates the cross product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn length(&self) -> f64

Computes the length (magnitude) of the Vec3 instance.

§Example
use moldyn_core::Vec3;

let v : Vec3 < u128 > = Vec3 :: < u128 > ::
new(2.0 as u128, 2.0 as u128, 1.0 as u128);

assert_eq!(v.length(), 3.0);
Source

pub fn length2(&self) -> u128

TODO: rethink: old codebase became buggy because we used the wrong method.

Source

pub fn normal(&self) -> Option<Self>

Normalizes the Vec3 instance to have a length of 1, returning an option containing a new Vec3 instance. If the original vector is zero-length, returns None to avoid division by zero.

Note: I’ve made this decision with the intention of propagating divisions by zero upwards the stack. I do not know if this will turn out to be useful.

Source§

impl Vec3<usize>

Source

pub fn dot(&self, other: &Self) -> usize

Creates the dot product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn cross(&self, other: &Self) -> Self

Creates the cross product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn length(&self) -> f64

Computes the length (magnitude) of the Vec3 instance.

§Example
use moldyn_core::Vec3;

let v : Vec3 < usize > = Vec3 :: < usize > ::
new(2.0 as usize, 2.0 as usize, 1.0 as usize);

assert_eq!(v.length(), 3.0);
Source

pub fn length2(&self) -> usize

TODO: rethink: old codebase became buggy because we used the wrong method.

Source

pub fn normal(&self) -> Option<Self>

Normalizes the Vec3 instance to have a length of 1, returning an option containing a new Vec3 instance. If the original vector is zero-length, returns None to avoid division by zero.

Note: I’ve made this decision with the intention of propagating divisions by zero upwards the stack. I do not know if this will turn out to be useful.

Source§

impl Vec3<i8>

Source

pub fn dot(&self, other: &Self) -> i8

Creates the dot product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn cross(&self, other: &Self) -> Self

Creates the cross product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn length(&self) -> f64

Computes the length (magnitude) of the Vec3 instance.

§Example
use moldyn_core::Vec3;

let v : Vec3 < i8 > = Vec3 :: < i8 > :: new(2.0 as i8, 2.0 as i8, 1.0 as i8);

assert_eq!(v.length(), 3.0);
Source

pub fn length2(&self) -> i8

TODO: rethink: old codebase became buggy because we used the wrong method.

Source

pub fn normal(&self) -> Option<Self>

Normalizes the Vec3 instance to have a length of 1, returning an option containing a new Vec3 instance. If the original vector is zero-length, returns None to avoid division by zero.

Note: I’ve made this decision with the intention of propagating divisions by zero upwards the stack. I do not know if this will turn out to be useful.

Source§

impl Vec3<i16>

Source

pub fn dot(&self, other: &Self) -> i16

Creates the dot product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn cross(&self, other: &Self) -> Self

Creates the cross product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn length(&self) -> f64

Computes the length (magnitude) of the Vec3 instance.

§Example
use moldyn_core::Vec3;

let v : Vec3 < i16 > = Vec3 :: < i16 > ::
new(2.0 as i16, 2.0 as i16, 1.0 as i16);

assert_eq!(v.length(), 3.0);
Source

pub fn length2(&self) -> i16

TODO: rethink: old codebase became buggy because we used the wrong method.

Source

pub fn normal(&self) -> Option<Self>

Normalizes the Vec3 instance to have a length of 1, returning an option containing a new Vec3 instance. If the original vector is zero-length, returns None to avoid division by zero.

Note: I’ve made this decision with the intention of propagating divisions by zero upwards the stack. I do not know if this will turn out to be useful.

Source§

impl Vec3<i32>

Source

pub fn dot(&self, other: &Self) -> i32

Creates the dot product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn cross(&self, other: &Self) -> Self

Creates the cross product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn length(&self) -> f64

Computes the length (magnitude) of the Vec3 instance.

§Example
use moldyn_core::Vec3;

let v : Vec3 < i32 > = Vec3 :: < i32 > ::
new(2.0 as i32, 2.0 as i32, 1.0 as i32);

assert_eq!(v.length(), 3.0);
Source

pub fn length2(&self) -> i32

TODO: rethink: old codebase became buggy because we used the wrong method.

Source

pub fn normal(&self) -> Option<Self>

Normalizes the Vec3 instance to have a length of 1, returning an option containing a new Vec3 instance. If the original vector is zero-length, returns None to avoid division by zero.

Note: I’ve made this decision with the intention of propagating divisions by zero upwards the stack. I do not know if this will turn out to be useful.

Source§

impl Vec3<i64>

Source

pub fn dot(&self, other: &Self) -> i64

Creates the dot product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn cross(&self, other: &Self) -> Self

Creates the cross product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn length(&self) -> f64

Computes the length (magnitude) of the Vec3 instance.

§Example
use moldyn_core::Vec3;

let v : Vec3 < i64 > = Vec3 :: < i64 > ::
new(2.0 as i64, 2.0 as i64, 1.0 as i64);

assert_eq!(v.length(), 3.0);
Source

pub fn length2(&self) -> i64

TODO: rethink: old codebase became buggy because we used the wrong method.

Source

pub fn normal(&self) -> Option<Self>

Normalizes the Vec3 instance to have a length of 1, returning an option containing a new Vec3 instance. If the original vector is zero-length, returns None to avoid division by zero.

Note: I’ve made this decision with the intention of propagating divisions by zero upwards the stack. I do not know if this will turn out to be useful.

Source§

impl Vec3<i128>

Source

pub fn dot(&self, other: &Self) -> i128

Creates the dot product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn cross(&self, other: &Self) -> Self

Creates the cross product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn length(&self) -> f64

Computes the length (magnitude) of the Vec3 instance.

§Example
use moldyn_core::Vec3;

let v : Vec3 < i128 > = Vec3 :: < i128 > ::
new(2.0 as i128, 2.0 as i128, 1.0 as i128);

assert_eq!(v.length(), 3.0);
Source

pub fn length2(&self) -> i128

TODO: rethink: old codebase became buggy because we used the wrong method.

Source

pub fn normal(&self) -> Option<Self>

Normalizes the Vec3 instance to have a length of 1, returning an option containing a new Vec3 instance. If the original vector is zero-length, returns None to avoid division by zero.

Note: I’ve made this decision with the intention of propagating divisions by zero upwards the stack. I do not know if this will turn out to be useful.

Source§

impl Vec3<isize>

Source

pub fn dot(&self, other: &Self) -> isize

Creates the dot product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn cross(&self, other: &Self) -> Self

Creates the cross product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn length(&self) -> f64

Computes the length (magnitude) of the Vec3 instance.

§Example
use moldyn_core::Vec3;

let v : Vec3 < isize > = Vec3 :: < isize > ::
new(2.0 as isize, 2.0 as isize, 1.0 as isize);

assert_eq!(v.length(), 3.0);
Source

pub fn length2(&self) -> isize

TODO: rethink: old codebase became buggy because we used the wrong method.

Source

pub fn normal(&self) -> Option<Self>

Normalizes the Vec3 instance to have a length of 1, returning an option containing a new Vec3 instance. If the original vector is zero-length, returns None to avoid division by zero.

Note: I’ve made this decision with the intention of propagating divisions by zero upwards the stack. I do not know if this will turn out to be useful.

Source§

impl Vec3<f32>

Source

pub fn dot(&self, other: &Self) -> f32

Creates the dot product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn cross(&self, other: &Self) -> Self

Creates the cross product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn length(&self) -> f64

Computes the length (magnitude) of the Vec3 instance.

§Example
use moldyn_core::Vec3;

let v : Vec3 < f32 > = Vec3 :: < f32 > ::
new(2.0 as f32, 2.0 as f32, 1.0 as f32);

assert_eq!(v.length(), 3.0);
Source

pub fn length2(&self) -> f32

TODO: rethink: old codebase became buggy because we used the wrong method.

Source

pub fn normal(&self) -> Option<Self>

Normalizes the Vec3 instance to have a length of 1, returning an option containing a new Vec3 instance. If the original vector is zero-length, returns None to avoid division by zero.

Note: I’ve made this decision with the intention of propagating divisions by zero upwards the stack. I do not know if this will turn out to be useful.

Source§

impl Vec3<f64>

Source

pub fn dot(&self, other: &Self) -> f64

Creates the dot product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn cross(&self, other: &Self) -> Self

Creates the cross product of two Vec3 instances of the same primitive type.

§Example
use moldyn_core::Vec3;

let v = Vec3::new(1.0, 2.0, 3.0);
let w = Vec3::new(4.0, 5.0, 6.0);

// TODO think about example output
Source

pub fn length(&self) -> f64

Computes the length (magnitude) of the Vec3 instance.

§Example
use moldyn_core::Vec3;

let v : Vec3 < f64 > = Vec3 :: < f64 > ::
new(2.0 as f64, 2.0 as f64, 1.0 as f64);

assert_eq!(v.length(), 3.0);
Source

pub fn length2(&self) -> f64

TODO: rethink: old codebase became buggy because we used the wrong method.

Source

pub fn normal(&self) -> Option<Self>

Normalizes the Vec3 instance to have a length of 1, returning an option containing a new Vec3 instance. If the original vector is zero-length, returns None to avoid division by zero.

Note: I’ve made this decision with the intention of propagating divisions by zero upwards the stack. I do not know if this will turn out to be useful.

Trait Implementations§

Source§

impl<T: Add<Output = T>> Add for Vec3<T>

Source§

fn add(self, other: Self) -> Self::Output

Implements the addition operator + for the Vec3 class.

§Example
use moldyn_core::Vec3;

let v: Vec3<f64> = Vec3::new(1.0, 2.0, 3.0);
let w: Vec3<f64> = Vec3::new(4.0, 5.0, 6.0);

assert_eq!(v + w, Vec3::new(5.0, 7.0, 9.0));
Source§

type Output = Vec3<T>

The resulting type after applying the + operator.
Source§

impl<T: AddAssign> AddAssign for Vec3<T>

Source§

fn add_assign(&mut self, rhs: Self)

Implements the addition-assign operation += for the Vec3 class.

Source§

impl<T: Clone> Clone for Vec3<T>

Source§

fn clone(&self) -> Vec3<T>

Returns a duplicate 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<T: Debug> Debug for Vec3<T>

Source§

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

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

impl<T: Default> Default for Vec3<T>

Source§

fn default() -> Vec3<T>

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

impl<'de, T> Deserialize<'de> for Vec3<T>
where T: Deserialize<'de> + Default,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<T: Display> Display for Vec3<T>

Source§

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

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

impl<T: Div<Output = T> + Copy> Div<T> for Vec3<T>

Source§

fn div(self, scalar: T) -> Self::Output

Implements the division operator / for the Vec3 class, allowing division of a vector by a scalar.

§Example
use moldyn_core::Vec3;

let v: Vec3<f64> = Vec3::new(2.0, 4.0, 6.0);
let w: Vec3<f64> = Vec3::new(1.0, 2.0, 3.0);

assert_eq!(v / 2.0, w);
Source§

type Output = Vec3<T>

The resulting type after applying the / operator.
Source§

impl<T: DivAssign + Copy> DivAssign<T> for Vec3<T>

Source§

fn div_assign(&mut self, rhs: T)

Implements the division-assign operation /= for the Vec3 class.

Source§

impl<T: Mul<Output = T> + Copy> Mul<T> for Vec3<T>

Source§

fn mul(self, scalar: T) -> Self::Output

Implements the scalar multiplication operator * for the Vec3 class.

§Example
use moldyn_core::Vec3;

let v: Vec3<f64> = Vec3::new(1.0, 2.0, 3.0);
let w: Vec3<f64> = Vec3::new(2.0, 4.0, 6.0);

assert_eq!(v * 2.0, w);
Source§

type Output = Vec3<T>

The resulting type after applying the * operator.
Source§

impl<T: MulAssign + Copy> MulAssign<T> for Vec3<T>

Source§

fn mul_assign(&mut self, rhs: T)

Implements the multiplication-assign operation *= for the Vec3 class.

Source§

impl<T: Neg<Output = T>> Neg for Vec3<T>

Source§

fn neg(self) -> Self::Output

Implements the unary negation operator - for the Vec3 class.

§Example
use moldyn_core::Vec3;

let v: Vec3<f64> = Vec3::new(1.0, 2.0, 3.0);
let w: Vec3<i32> = Vec3::new(1, 2, 3);

assert_eq!(-v, Vec3::new(-1.0, -2.0, -3.0));
assert_eq!(-w, Vec3::new(-1, -2, -3));
Source§

type Output = Vec3<T>

The resulting type after applying the - operator.
Source§

impl<T: PartialEq> PartialEq for Vec3<T>

Source§

fn eq(&self, other: &Vec3<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> Serialize for Vec3<T>
where T: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<T: Sub<Output = T>> Sub for Vec3<T>

Source§

fn sub(self, other: Self) -> Self::Output

Implements the subtraction operator - for the Vec3 class.

§Example
use moldyn_core::Vec3;

let v: Vec3<f64> = Vec3::new(1.0, 2.0, 3.0);
let w: Vec3<f64> = Vec3::new(4.0, 5.0, 6.0);

assert_eq!(v - w, Vec3::new(-3.0, -3.0, -3.0));
Source§

type Output = Vec3<T>

The resulting type after applying the - operator.
Source§

impl<T: SubAssign> SubAssign for Vec3<T>

Source§

fn sub_assign(&mut self, rhs: Self)

Implements the subtraction-assign operation -= for the Vec3 class.

Source§

impl Copy for Vec3<f64>

Source§

impl Copy for Vec3<f32>

Source§

impl Copy for Vec3<i128>

Source§

impl Copy for Vec3<i16>

Source§

impl Copy for Vec3<i32>

Source§

impl Copy for Vec3<i64>

Source§

impl Copy for Vec3<i8>

Source§

impl Copy for Vec3<isize>

Source§

impl Copy for Vec3<u128>

Source§

impl Copy for Vec3<u16>

Source§

impl Copy for Vec3<u32>

Source§

impl Copy for Vec3<u64>

Source§

impl Copy for Vec3<u8>

Source§

impl Copy for Vec3<usize>

Source§

impl<T> StructuralPartialEq for Vec3<T>

Auto Trait Implementations§

§

impl<T> Freeze for Vec3<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Vec3<T>
where T: RefUnwindSafe,

§

impl<T> Send for Vec3<T>
where T: Send,

§

impl<T> Sync for Vec3<T>
where T: Sync,

§

impl<T> Unpin for Vec3<T>
where T: Unpin,

§

impl<T> UnwindSafe for Vec3<T>
where T: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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

Source§

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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,