Skip to main content

CubeEnum

Trait CubeEnum 

Source
pub trait CubeEnum: Sized {
    type RuntimeValue: Clone + CubeDebug;

    // Required methods
    fn discriminant(&self) -> NativeExpand<i32>;
    fn runtime_value(self) -> Self::RuntimeValue;
    fn discriminant_of(variant_name: &'static str) -> i32;

    // Provided method
    fn discriminant_of_value(&self, variant_name: &'static str) -> i32 { ... }
}

Required Associated Types§

Required Methods§

Source

fn discriminant(&self) -> NativeExpand<i32>

Source

fn runtime_value(self) -> Self::RuntimeValue

Return the runtime value of this enum, if only one variant has a value. Should return () for all other cases.

Source

fn discriminant_of(variant_name: &'static str) -> i32

Provided Methods§

Source

fn discriminant_of_value(&self, variant_name: &'static str) -> i32

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§