Trait glamour::Swizzle

source ·
pub trait Swizzle<T: Unit> {
    // Required methods
    fn swizzle2<const X: usize, const Y: usize>(&self) -> Vector2<T>;
    fn swizzle3<const X: usize, const Y: usize, const Z: usize>(
        &self
    ) -> Vector3<T>;
    fn swizzle4<const X: usize, const Y: usize, const Z: usize, const W: usize>(
        &self
    ) -> Vector4<T>;
}
Expand description

Vector swizzling by const generics.

For GLSL-like swizzling, see glam::Vec2Swizzles, glam::Vec3Swizzles, or glam::Vec4Swizzles.

Required Methods§

source

fn swizzle2<const X: usize, const Y: usize>(&self) -> Vector2<T>

Select two components from this vector and return a 2D vector made from those components.

source

fn swizzle3<const X: usize, const Y: usize, const Z: usize>(&self) -> Vector3<T>

Select three components from this vector and return a 3D vector made from those components.

source

fn swizzle4<const X: usize, const Y: usize, const Z: usize, const W: usize>( &self ) -> Vector4<T>

Select four components from this vector and return a 4D vector made from those components.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T: Unit> Swizzle<T> for Vector2<T>

source§

impl<T: Unit> Swizzle<T> for Vector3<T>

source§

impl<T: Unit> Swizzle<T> for Vector4<T>