Trait moore_vhdl::ty2::EnumType
source · [−]pub trait EnumType: Type {
fn as_type(&self) -> &dyn Type;
fn variants(&self) -> &[EnumVariant];
fn range(&self) -> Range<usize>;
fn base_type(&self) -> &dyn Type;
fn is_equal(&self, other: &dyn EnumType) -> bool;
fn resolution_func(&self) -> Option<usize> { ... }
fn as_basetype(&self) -> Option<&EnumBasetype> { ... }
fn as_subtype(&self) -> Option<&EnumSubtype<'_>> { ... }
fn unwrap_basetype(&self) -> &EnumBasetype { ... }
fn unwrap_subtype(&self) -> &EnumSubtype<'_> { ... }
}
Expand description
An enumeration type.
This can either be an EnumBasetype
or an EnumSubtype
.
Required methods
fn variants(&self) -> &[EnumVariant]
fn variants(&self) -> &[EnumVariant]
The variants of this enumeration type.
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.
Provided methods
fn resolution_func(&self) -> Option<usize>
fn resolution_func(&self) -> Option<usize>
The resolution function associated with this type.
fn as_basetype(&self) -> Option<&EnumBasetype>
fn as_basetype(&self) -> Option<&EnumBasetype>
Returns Some
if self is an EnumBasetype
, None
otherwise.
fn as_subtype(&self) -> Option<&EnumSubtype<'_>>
fn as_subtype(&self) -> Option<&EnumSubtype<'_>>
Returns Some
if self is an EnumSubtype
, None
otherwise.
fn unwrap_basetype(&self) -> &EnumBasetype
fn unwrap_basetype(&self) -> &EnumBasetype
Returns an &EnumBasetype
or panics if the type is not a basetype.
fn unwrap_subtype(&self) -> &EnumSubtype<'_>
fn unwrap_subtype(&self) -> &EnumSubtype<'_>
Returns an &EnumSubtype
or panics if the type is not a subtype.