pub trait VecN<T: Number>:
Base<T>
+ Dot<T>
+ Index<usize, Output = T>
+ IndexMut<usize>
+ Add<T, Output = Self>
+ Sub<T, Output = Self>
+ Mul<T, Output = Self>
+ Div<T, Output = Self> {
Show 20 methods
// Required methods
fn len() -> usize;
fn all(a: Self) -> bool;
fn any(a: Self) -> bool;
fn unit_x() -> Self;
fn unit_y() -> Self;
fn unit_z() -> Self;
fn unit_w() -> Self;
fn red() -> Self;
fn green() -> Self;
fn blue() -> Self;
fn cyan() -> Self;
fn magenta() -> Self;
fn yellow() -> Self;
fn black() -> Self;
fn white() -> Self;
fn as_slice(&self) -> &[T];
fn as_mut_slice(&mut self) -> &mut [T];
fn as_u8_slice(&self) -> &[u8] ⓘ;
fn max_scalar(a: Self) -> T;
fn min_scalar(a: Self) -> T;
}Expand description
generic vec trait to allow sized vectors to be treated generically
Required Methods§
Sourcefn unit_z() -> Self
fn unit_z() -> Self
returns a vector initialised as a unit vector in the z-axis [0, 0, 1, 0] value will be truncated to 0 for vectors < 3 dimension
Sourcefn unit_w() -> Self
fn unit_w() -> Self
returns a vector initialised as a unit vector in the w-axis [0, 0, 0, 1] value will be truncated to 0 for vectors < 4 dimension
Sourcefn blue() -> Self
fn blue() -> Self
returns a vector initialised to blue [0, 0, 1, 1] value will be truncated to 0 for vectors < 3 dimension
Sourcefn cyan() -> Self
fn cyan() -> Self
returns a vector initialised to cyan [0, 1, 1, 1] value will be truncated to green for vectors < 3 dimension
Sourcefn magenta() -> Self
fn magenta() -> Self
returns a vector initialised to magenta [1, 0, 1, 1] value will be truncated to red for vectors < 3 dimension
Sourcefn as_mut_slice(&mut self) -> &mut [T]
fn as_mut_slice(&mut self) -> &mut [T]
returns a mutable slice T of the vector
Sourcefn as_u8_slice(&self) -> &[u8] ⓘ
fn as_u8_slice(&self) -> &[u8] ⓘ
returns a slice of bytes for the vector
Sourcefn max_scalar(a: Self) -> T
fn max_scalar(a: Self) -> T
returns the largest scalar value component contained in the vector a
Sourcefn min_scalar(a: Self) -> T
fn min_scalar(a: Self) -> T
returns the smallest scalar value component contained in the vector a
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.