pub fn new(mark: &'t TypeMark<'t>, range: Range<BigInt>) -> Option<PhysicalSubtype<'t>> {
        let base = mark.as_any().as_physical()?;
        let base_range = base.range();
        if base_range.has_subrange(&range) {
            Some(PhysicalSubtype {
                resfn: base.resolution_func(),
                mark: mark,
                base: base,
                con: range,
            })
        } else {
            None
        }
    }
/// 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");
/// ```
Create a new integer subtype.
Create a new integer subtype .
pub fn new(mark: &'t TypeMark<'t>, range: Range<BigInt>) -> Option<PhysicalSubtype<'t>> {
        let base = mark.as_any().as_physical()?;
        let base_range = base.range();
        if base_range.has_subrange(&range) {
            Some(PhysicalSubtype {
                resfn: base.resolution_func(),
                mark: mark,
                base: base,
                con: range,
            })
        } else {
            None
        }
    }
pub fn new ( mark : & ' t TypeMark < ' t > , range : Range < BigInt > ) -> Option < PhysicalSubtype < ' t > > { let base = mark . as_any ( ) . as_physical ( ) ? ; let base_range = base . range ( ) ; if base_range . has_subrange ( & range ) { Some ( PhysicalSubtype { resfn : base . resolution_func ( ) , mark : mark , base : base , con : range , } ) } else { None } }
Create a new integer subtype.
Create a new integer subtype .
mark
&'t TypeMark<'t>
range
Range<BigInt>
mark
&'t TypeMark<'t>
range
Range<BigInt>
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().


` ` ` 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 () .