Trait OptionallyConst

Source
pub trait OptionallyConst<T> {
    const MAYBE_CONST: Option<T>;

    // Required method
    fn into_value(self) -> T;
}
Expand description

A trait that can be used to represent a type that is either type T or a type that represents a constant value of type T.

I.e. OptionallyConst<T> is either T or U: Const<T>.

See the Const trait for more information.

Required Associated Constants§

Source

const MAYBE_CONST: Option<T>

An optional constant value of type T.

If the type does not represent a constant (i.e. does not implement Const), this will be None.

Required Methods§

Source

fn into_value(self) -> T

Converts the instance of the type into a value of type T.

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§