pub trait Vector {
type Scalar: Copy;
// Required methods
fn add(&self, other: &Self) -> Self;
fn subtract(&self, other: &Self) -> Self;
fn scale(&self, scalar: Self::Scalar) -> Self;
fn dot(&self, other: &Self) -> Self::Scalar;
fn cross(&self, other: &Self) -> Self;
fn length(&self) -> Self::Scalar;
fn normalize(&self) -> Self;
fn size(&self) -> usize;
fn at(&self, index: usize) -> Self::Scalar;
fn update(&mut self, index: usize, value: Self::Scalar);
}
Expand description
Generalized Vector operations that can be implemented by any vector like type.
Required Associated Types§
Required Methods§
fn add(&self, other: &Self) -> Self
fn subtract(&self, other: &Self) -> Self
fn scale(&self, scalar: Self::Scalar) -> Self
fn dot(&self, other: &Self) -> Self::Scalar
fn cross(&self, other: &Self) -> Self
fn length(&self) -> Self::Scalar
fn normalize(&self) -> Self
fn size(&self) -> usize
fn at(&self, index: usize) -> Self::Scalar
fn update(&mut self, index: usize, value: Self::Scalar)
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.