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

A subtype of an integer type.

Implementations

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_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

Formats the value using the given formatter. Read more

Convert to a type.

The range of values this integer can assume. Read more

The base type of this integer.

Returns Some if self is an IntegerSubtype, None otherwise.

Check if two integer types are equal.

The resolution function associated with this type.

Returns Some if self is an IntegerBasetype, None otherwise.

Checks whether this is a universal integer type.

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

Returns an &IntegerSubtype 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.