Skip to main content

Components

Trait Components 

Source
pub trait Components<T, const N: usize>: Copy {
    // Required methods
    fn to_array(self) -> [T; N];
    fn from_array(a: [T; N]) -> Self;
}
Expand description

Trait for types whose components can be accessed as a fixed-size array.

This is the geometric analogue of ChannelArray in optic-color. It enables generic componentwise operations (min, max) across different geometric types.

Implemented for Size2D, Size3D, [Coord2D], [CoordOffset].

Required Methods§

Source

fn to_array(self) -> [T; N]

Convert to an array of length N.

Source

fn from_array(a: [T; N]) -> Self

Construct from an array of length N.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§