pub type PhysicalSubtype<'t> = ScalarSubtype<'t, dyn PhysicalType, 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, PhysicalUnit, PhysicalBasetype, PhysicalSubtype, Range};
use moore_common::name::get_name_table;

let ty = PhysicalBasetype::new(Range::ascending(-1000isize, 1000isize), vec![
    PhysicalUnit::primary(get_name_table().intern("fs", false), 1),
    PhysicalUnit::secondary(get_name_table().intern("ps", false), 1000, 1000, 0),
], 0);
let tm = TypeMark::new(
    get_name_table().intern("TIME", false),
    &ty,
);
let a = PhysicalSubtype::new(&tm, Range::ascending(0isize, 100isize)).unwrap();
let b = PhysicalSubtype::new(&tm, Range::descending(100isize, 0isize)).unwrap();

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

Trait Implementations

Formats the value using the given formatter. Read more

Convert to a type.

The range of values this physical type can assume.

The units of measure of this type.

The index of the primary unit.

The base type of this physical type.

Returns Some if self is a PhysicalSubtype, None otherwise.

Check if two physical types are equal.

The resolution function associated with this type.

Returns Some if self is a PhysicalBasetype, None otherwise.

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

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