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

type IntegerSubtype<'t> = ScalarSubtype<'t, dyn IntegerType, BigInt>;

A subtype of an integer type.

Methods

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

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

Create a new integer subtype.

Returns Some(...) if range is a subrange of the integer, or None otherwise.

Example

use moore_vhdl::ty2::{Type, TypeMark, IntegerBasetype, IntegerSubtype, Range};
use moore_vhdl::common::name::get_name_table;

let ty = IntegerBasetype::new(Range::ascending(0usize, 255usize));
let tm = TypeMark::new(
    get_name_table().intern("BYTE", false),
    &ty,
);
let a = IntegerSubtype::new(&tm, Range::ascending(0usize, 15usize)).unwrap();
let b = IntegerSubtype::new(&tm, Range::descending(15usize, 0usize)).unwrap();

assert_eq!(format!("{}", a), "BYTE range 0 to 15");
assert_eq!(format!("{}", b), "BYTE range 15 downto 0");

Trait Implementations

impl<'t> Type for IntegerSubtype<'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> IntegerType for IntegerSubtype<'t>
[src]

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

The resolution function associated with this type.

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

Returns Some if self is an IntegerBasetype, None otherwise.

fn is_universal(&self) -> bool
[src]

Checks whether this is a universal integer type.

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

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

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

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

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