Trait LinearizeExt

Source
pub trait LinearizeExt: Linearize + Sealed {
    // Required methods
    fn from_linear(linear: usize) -> Option<Self>
       where Self: Sized;
    fn variants() -> Variants<Self> 
       where Self: Sized;
    fn linearized(&self) -> Linearized<Self>;
}
Expand description

Extension trait for types implementing Linearize.

Required Methods§

Source

fn from_linear(linear: usize) -> Option<Self>
where Self: Sized,

A safe version of Linearize::from_linear_unchecked.

This function returns None if linear >= Self::LENGTH.

Source

fn variants() -> Variants<Self>
where Self: Sized,

Returns an iterator over all values of this type.

Source

fn linearized(&self) -> Linearized<Self>

Linearizes this value and stores the value in a Linearized object.

See the documentation of Linearized for why this might be useful.

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§

Source§

impl<T> LinearizeExt for T
where T: Linearize + ?Sized,