Skip to main content

Matchable

Trait Matchable 

Source
pub unsafe trait Matchable {
    const VARIANTS: &'static [&'static str];

    // Required method
    unsafe fn variant_at(ptr: *const Self) -> &'static str;
}
Expand description

A type whose values can be matched.

For every value VARIANT in Self::VARIANTS, Self implements HasVariant<VARIANT>. Casting a pointer to Self to <Self as HasVariant<VARIANTS>>::VariantType is sound when variant_at returned VARIANT.

Required Associated Constants§

Source

const VARIANTS: &'static [&'static str]

Required Methods§

Source

unsafe fn variant_at(ptr: *const Self) -> &'static str

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§