Skip to main content

FromConst

Trait FromConst 

Source
pub trait FromConst<const V: i128>: Sized {
    const VALUE: Self;
}
Expand description

Types that can be created from an integer constant expression validated at compile time.

Implement this trait to make a type usable with cv!. Use the cv! macro, not this trait directly, for creating values.

Required Associated Constants§

Source

const VALUE: Self

The value that corresponds to the constant V.

Fails the build if V is not a valid value for Self.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<const V: i128> FromConst<V> for NonZero<i8>

Source§

const VALUE: Self

Source§

impl<const V: i128> FromConst<V> for NonZero<i16>

Source§

const VALUE: Self

Source§

impl<const V: i128> FromConst<V> for NonZero<i32>

Source§

const VALUE: Self

Source§

impl<const V: i128> FromConst<V> for NonZero<i64>

Source§

const VALUE: Self

Source§

impl<const V: i128> FromConst<V> for NonZero<isize>

Source§

const VALUE: Self

Source§

impl<const V: i128> FromConst<V> for NonZero<u8>

Source§

const VALUE: Self

Source§

impl<const V: i128> FromConst<V> for NonZero<u16>

Source§

const VALUE: Self

Source§

impl<const V: i128> FromConst<V> for NonZero<u32>

Source§

const VALUE: Self

Source§

impl<const V: i128> FromConst<V> for NonZero<u64>

Source§

const VALUE: Self

Source§

impl<const V: i128> FromConst<V> for NonZero<usize>

Source§

const VALUE: Self

Source§

impl<const V: i128> FromConst<V> for i8

Source§

const VALUE: Self

Source§

impl<const V: i128> FromConst<V> for i16

Source§

const VALUE: Self

Source§

impl<const V: i128> FromConst<V> for i32

Source§

const VALUE: Self

Source§

impl<const V: i128> FromConst<V> for i64

Source§

const VALUE: Self

Source§

impl<const V: i128> FromConst<V> for isize

Source§

const VALUE: Self

Source§

impl<const V: i128> FromConst<V> for u8

Source§

const VALUE: Self

Source§

impl<const V: i128> FromConst<V> for u16

Source§

const VALUE: Self

Source§

impl<const V: i128> FromConst<V> for u32

Source§

const VALUE: Self

Source§

impl<const V: i128> FromConst<V> for u64

Source§

const VALUE: Self

Source§

impl<const V: i128> FromConst<V> for usize

Source§

const VALUE: Self

Implementors§

Source§

impl<const N: u32, const V: i128> FromConst<V> for Bounded<i8, N>

Source§

const VALUE: Self

Source§

impl<const N: u32, const V: i128> FromConst<V> for Bounded<i16, N>

Source§

const VALUE: Self

Source§

impl<const N: u32, const V: i128> FromConst<V> for Bounded<i32, N>

Source§

const VALUE: Self

Source§

impl<const N: u32, const V: i128> FromConst<V> for Bounded<i64, N>

Source§

const VALUE: Self

Source§

impl<const N: u32, const V: i128> FromConst<V> for Bounded<isize, N>

Source§

const VALUE: Self

Source§

impl<const N: u32, const V: i128> FromConst<V> for Bounded<u8, N>

Source§

const VALUE: Self

Source§

impl<const N: u32, const V: i128> FromConst<V> for Bounded<u16, N>

Source§

const VALUE: Self

Source§

impl<const N: u32, const V: i128> FromConst<V> for Bounded<u32, N>

Source§

const VALUE: Self

Source§

impl<const N: u32, const V: i128> FromConst<V> for Bounded<u64, N>

Source§

const VALUE: Self

Source§

impl<const N: u32, const V: i128> FromConst<V> for Bounded<usize, N>

Source§

const VALUE: Self

Source§

impl<const V: i128> FromConst<V> for Alignment

Source§

const VALUE: Self