Basis

Trait Basis 

Source
pub trait Basis<const I: usize>: VectorSpace {
    // Required methods
    fn basis(&self) -> Self::Scalar;
    fn basis_mut(&mut self) -> &mut Self::Scalar;

    // Provided methods
    fn unit_basis() -> Self { ... }
    fn basis_of(magnitude: Self::Scalar) -> Self { ... }
    fn with_basis(self, magnitude: Self::Scalar) -> Self { ... }
}
Expand description

This trait makes it possible to deal with the bases of a vector in a generic way.

Required Methods§

Source

fn basis(&self) -> Self::Scalar

Queries a basis of a vector space.

Source

fn basis_mut(&mut self) -> &mut Self::Scalar

Queries a basis of a vector space as a mutable reference.

Provided Methods§

Source

fn unit_basis() -> Self

Creates an unit basis of the vector space.

Source

fn basis_of(magnitude: Self::Scalar) -> Self

Creates a scaled basis of the vector space of the specified magnitude.

Source

fn with_basis(self, magnitude: Self::Scalar) -> Self

Creates a new vector with a single basis set to a different value.

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.

Implementors§