Trait ConstValue

Source
pub trait ConstValue {
    type Value: Copy;

    const VALUE: Self::Value;
}
Expand description

A trait that has one associated constant value.

To implement this trait, use use_modtype rather than the derive macro.

§Example

use modtype::ConstValue;

#[derive(ConstValue)]
#[modtype(const_value = 17u32)]
enum Const17U32 {}

assert_eq!(Const17U32::VALUE, 17u32);

Required Associated Constants§

Source

const VALUE: Self::Value

Required Associated Types§

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§