Skip to main content

SupportedLength

Trait SupportedLength 

Source
pub trait SupportedLength: Sealed { }
Expand description

Marker trait restricting the length of math types.

For simplicity, math types such as Vector do not support arbitrary lengths. Supporting types like Vec10<T> would quickly lead to excessive API bloat. Instead, all math types must have a length of either 2, 3, or 4.

This restriction is enforced in the type system using the Length<N> marker type. SupportedLength is implemented only for Length<2>, Length<3>, and Length<4>.

§Usage

use ggmath::{Length, SupportedLength};

struct MathType<const N: usize>
where
    Length<N>: SupportedLength,
{
    // ...
}

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§