Trait HasXYZ

Source
pub trait HasXYZ: HasXY {
    // Required methods
    fn new_3d(x: Self::Scalar, y: Self::Scalar, z: Self::Scalar) -> Self;
    fn z(self) -> Self::Scalar;
    fn z_mut(&mut self) -> &mut Self::Scalar;
    fn set_z(&mut self, val: Self::Scalar);
}
Expand description

A basic three-dimensional vector trait, designed for flexibility in precision.

The HasXYZ trait abstracts over three-dimensional vectors, allowing for easy transition between different precisions (e.g., f32 and f64) without necessitating significant codebase modifications. It only provides the most basic vector interface. It is intended to be used in situations where you need a custom storage type of vectors. For example a FFI type.

Implementors of this trait can benefit from the ability to switch between different precision representations seamlessly, making it ideal for applications where varying precision levels might be desirable at different stages or configurations.

Required Methods§

Source

fn new_3d(x: Self::Scalar, y: Self::Scalar, z: Self::Scalar) -> Self

Source

fn z(self) -> Self::Scalar

Source

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

Source

fn set_z(&mut self, val: 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.

Implementors§