[][src]Type Definition moore_vhdl::ty2::EnumSubtype

type EnumSubtype<'t> = ScalarSubtype<'t, dyn EnumType, usize>;

A subtype of an enumeration type.

Methods

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

pub fn new(
    mark: &'t TypeMark<'t>,
    range: Range<usize>
) -> Option<EnumSubtype<'t>>
[src]

Create a new enumeration subtype.

Example

use moore_vhdl::ty2::{Type, TypeMark, EnumBasetype, EnumSubtype, Range};
use moore_vhdl::common::name::get_name_table;

let ty = EnumBasetype::new(vec![
    "first".into(),
    "second".into(),
    '0'.into(),
    '1'.into(),
]);
let tm = TypeMark::new(
    get_name_table().intern("MY_TYPE", false),
    &ty,
);
let subty = EnumSubtype::new(&tm, Range::ascending(1usize, 2usize)).unwrap();

assert_eq!(format!("{}", subty), "MY_TYPE range second to '0'");

Trait Implementations

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

fn is_equal(&self, other: &dyn Type) -> bool
[src]

Check if two types are equal.

fn is_implicitly_castable(&self, _into: &dyn Type) -> bool
[src]

Check if the type can be implicitly cast to another.

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

fn resolution_func(&self) -> Option<usize>
[src]

The resolution function associated with this type.

fn as_basetype(&self) -> Option<&EnumBasetype>
[src]

Returns Some if self is an EnumBasetype, None otherwise.

fn unwrap_basetype(&self) -> &EnumBasetype
[src]

Returns an &EnumBasetype or panics if the type is not a basetype.

fn unwrap_subtype(&self) -> &EnumSubtype
[src]

Returns an &EnumSubtype or panics if the type is not a subtype.

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