pub unsafe trait GetEnumInfo: Sized {
type Discriminant: ValidDiscriminant;
type DefaultStorage;
type DefaultInterface;
const ENUM_INFO: &'static EnumInfo;
const DISCRIMINANTS: &'static [Self::Discriminant];
// Required method
fn is_valid_discriminant(discriminant: Self::Discriminant) -> bool;
}
Expand description
Describes the discriminant of an enum,and its valid values.
§Safety
This must be an enum with a #[repr(C)]
or #[repr(SomeInteFgerType)]
attribute.
The Discriminant
associated type must correspond to the type of
this enum’s discriminant.
The DISCRIMINANTS
associated constant must be the values of
this enum’s discriminants.
Required Associated Constants§
Sourceconst DISCRIMINANTS: &'static [Self::Discriminant]
const DISCRIMINANTS: &'static [Self::Discriminant]
The values of the discriminants of each variant.
Required Associated Types§
Sourcetype Discriminant: ValidDiscriminant
type Discriminant: ValidDiscriminant
The type of the discriminant.
Sourcetype DefaultStorage
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.
Sourcetype DefaultInterface
type DefaultInterface
The default InterfaceType,
used to determine the traits that are required when constructing a NonExhaustive<>
,
and are then usable afterwards.
Required Methods§
Sourcefn is_valid_discriminant(discriminant: Self::Discriminant) -> bool
fn is_valid_discriminant(discriminant: Self::Discriminant) -> bool
Whether discriminant
is one of the valid discriminants for this enum in this context.
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.