[][src]Trait moore_vhdl::ty2::EnumType

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 { ... } }

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.

Loading content...

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.

Loading content...

Trait Implementations

impl<'t> Eq for dyn EnumType + 't[src]

impl<'t> PartialEq<dyn EnumType + 't> for dyn EnumType + 't[src]

Implementors

impl EnumType for EnumBasetype[src]

impl<'t> EnumType for EnumSubtype<'t>[src]

Loading content...