[][src]Trait abi_stable::nonexhaustive_enum::traits::GetEnumInfo

pub unsafe trait GetEnumInfo: Sized {
    type Discriminant: ValidDiscriminant;
    type DefaultStorage;
    type DefaultInterface;

    const ENUM_INFO: &'static EnumInfo;

    fn discriminants() -> &'static [Self::Discriminant];
fn is_valid_discriminant(discriminant: Self::Discriminant) -> bool; }

Describes the discriminant of an enum,and its valid values.

Safety

This must be an enum with a #[repr(C)] or #[repr(SomeIntegerType)] attribute.

The type of the discriminant must match Self::NonExhaustive.

Associated Types

type Discriminant: ValidDiscriminant

The type of the discriminant.

type DefaultStorage

The default storage type, used to store this enum inside NonExhaustive<>, and allow the enum to grow in size in newer ABI compatible versions.

type DefaultInterface

The default InterfaceType, used to determine the traits that are required when constructing a NonExhaustive<>, and are then usable afterwards.

Loading content...

Associated Constants

const ENUM_INFO: &'static EnumInfo

Information about the enum.

Loading content...

Required methods

fn discriminants() -> &'static [Self::Discriminant]

The values of the discriminants of each variant.

This is a function instead of an associated constant because it breaks in Rust 1.34 otherwise .

fn is_valid_discriminant(discriminant: Self::Discriminant) -> bool

Whether discriminant is one of the valid discriminants for this enum in this context.

Loading content...

Implementors

Loading content...