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

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

A subtype of an enumeration type.

Implementations

Create a new enumeration subtype.

Example
use moore_vhdl::ty2::{Type, TypeMark, EnumBasetype, EnumSubtype, Range};
use moore_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

Formats the value using the given formatter. Read more

Convert to a type.

The variants of this enumeration type.

The range of variants this type can assume. Read more

The base type of this enumeration.

Returns Some if self is an EnumSubtype, None otherwise.

Check if two enumeration types are equal.

The resolution function associated with this type.

Returns Some if self is an EnumBasetype, None otherwise.

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

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

Check if this is a scalar type. Read more

Check if this is a discrete type. Read more

Check if this is a numeric type. Read more

Check if this is a composite type. Read more

Converts from &Type to AnyType.

Convert into an owned type.

Clone this type.

Check if two types are equal.

Check if the type can be implicitly cast to another.