[−][src]Type Definition moore_vhdl::ty2::PhysicalSubtype
type PhysicalSubtype<'t> = ScalarSubtype<'t, dyn PhysicalType, BigInt>;
A subtype of an integer type.
Implementations
impl<'t> PhysicalSubtype<'t>
[src]
pub fn new(
mark: &'t TypeMark<'t>,
range: Range<BigInt>
) -> Option<PhysicalSubtype<'t>>
[src]
mark: &'t TypeMark<'t>,
range: Range<BigInt>
) -> Option<PhysicalSubtype<'t>>
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
impl<'t> Display for PhysicalSubtype<'t>
[src]
impl<'t> PhysicalType for PhysicalSubtype<'t>
[src]
fn as_type(&self) -> &dyn Type
[src]
fn range(&self) -> &Range<BigInt>
[src]
fn units(&self) -> &[PhysicalUnit]
[src]
fn primary_index(&self) -> usize
[src]
fn base_type(&self) -> &dyn Type
[src]
fn as_subtype(&self) -> Option<&PhysicalSubtype>
[src]
fn is_equal(&self, other: &dyn PhysicalType) -> bool
[src]
fn resolution_func(&self) -> Option<usize>
[src]
fn as_basetype(&self) -> Option<&PhysicalBasetype>
[src]
fn unwrap_basetype(&self) -> &PhysicalBasetype
[src]
fn unwrap_subtype(&self) -> &PhysicalSubtype
[src]
impl<'t> Type for PhysicalSubtype<'t>
[src]
fn is_scalar(&self) -> bool
[src]
fn is_discrete(&self) -> bool
[src]
fn is_numeric(&self) -> bool
[src]
fn is_composite(&self) -> bool
[src]
fn as_any(&self) -> AnyType
[src]
fn into_owned<'a>(self) -> OwnedType<'a> where
Self: 'a,
[src]
Self: 'a,
fn to_owned<'a>(&self) -> OwnedType<'a> where
Self: 'a,
[src]
Self: 'a,