[−][src]Trait moore_vhdl::ty2::EnumType
An enumeration type.
This can either be an EnumBasetype
or an EnumSubtype
.
Required methods
fn as_type(&self) -> &dyn Type
Convert to a type.
fn variants(&self) -> &[EnumVariant]
The variants of this enumeration type.
fn range(&self) -> Range<usize>
The range of variants this type can assume.
This is used to support subtyping of enumerations, where a subtype might only accept a subrange of the original variants.
fn base_type(&self) -> &dyn Type
The base type of this enumeration.
fn is_equal(&self, other: &dyn EnumType) -> bool
Check if two enumeration types are equal.
Provided methods
fn resolution_func(&self) -> Option<usize>
The resolution function associated with this type.
fn as_basetype(&self) -> Option<&EnumBasetype>
Returns Some
if self is an EnumBasetype
, None
otherwise.
fn as_subtype(&self) -> Option<&EnumSubtype>
Returns Some
if self is an EnumSubtype
, None
otherwise.
fn unwrap_basetype(&self) -> &EnumBasetype
Returns an &EnumBasetype
or panics if the type is not a basetype.
fn unwrap_subtype(&self) -> &EnumSubtype
Returns an &EnumSubtype
or panics if the type is not a subtype.