Skip to main content

Reflect

Trait Reflect 

Source
pub trait Reflect {
    type Value;

    // Required method
    fn reflect() -> Self::Value;
}
Expand description

Converts a type-level value into a runtime value.

Types implementing Reflect carry a compile-time value that can be extracted at runtime via Reflect::reflect.

§Examples

use reify_reflect_core::{Reflect, RuntimeValue};

struct MyZero;

impl Reflect for MyZero {
    type Value = RuntimeValue;
    fn reflect() -> Self::Value {
        RuntimeValue::Nat(0)
    }
}

assert_eq!(MyZero::reflect(), RuntimeValue::Nat(0));

Required Associated Types§

Source

type Value

The runtime representation of this type-level value.

Required Methods§

Source

fn reflect() -> Self::Value

Produce the runtime value corresponding to this type-level value.

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§