/// Create a new enumeration subtype.
///
/// # Example
///
/// ```
/// use moore_vhdl::ty2::{Type, TypeMark, EnumBasetype, EnumSubtype, Range};
/// use moore_common::name::get_name_table;
///
/// let ty = EnumBasetype::new(vec![
///     "first".into(),
///     "second".into(),
///     '0'.into(),
///     '1'.into(),
/// ]);
/// let tm = TypeMark::new(
///     get_name_table().intern("MY_TYPE", false),
///     &ty,
/// );
/// let subty = EnumSubtype::new(&tm, Range::ascending(1usize, 2usize)).unwrap();
///
/// assert_eq!(format!("{}", subty), "MY_TYPE range second to '0'");
/// ```
Create a new enumeration subtype.
Create a new enumeration subtype .
pub fn new(mark: &'t TypeMark<'t>, range: Range<usize>) -> Option<EnumSubtype<'t>> {
        let base = mark.as_any().unwrap_enum();
        let base_range = base.range();
        if base_range.has_subrange(&range) {
            Some(EnumSubtype {
                resfn: None,
                mark: mark,
                base: base,
                con: range,
            })
        } else {
            None
        }
    }
pub fn new ( mark : & ' t TypeMark < ' t > , range : Range < usize > ) -> Option < EnumSubtype < ' t > > { let base = mark . as_any ( ) . unwrap_enum ( ) ; let base_range = base . range ( ) ; if base_range . has_subrange ( & range ) { Some ( EnumSubtype { resfn : None , mark : mark , base : base , con : range , } ) } else { None } }
Create a new enumeration subtype.
Create a new enumeration subtype .
mark
&'t TypeMark<'t>
range
Range<usize>
example
```
use moore_vhdl::ty2::{Type, TypeMark, EnumBasetype, EnumSubtype, Range};
use moore_common::name::get_name_table.

let ty = EnumBasetype::new(vec![
"first".into(),
"second".into(),
'0'.into(),
'1'.into(),
]);
let tm = TypeMark::new(
get_name_table().intern("MY_TYPE", false),
&ty,
);
let subty = EnumSubtype::new(&tm, Range::ascending(1usize, 2usize)).unwrap().


` ` ` use moore_vhdl :: ty2 :: { Type TypeMark EnumBasetype EnumSubtype Range } ; use moore_common :: name :: get_name_table . let ty = EnumBasetype :: new ( vec! [ " first " . into () " second " . into () ' 0 ' . into () ' 1 ' . into () ] ) ; let tm = TypeMark :: new ( get_name_table () . intern ( " MY_TYPE " false ) &ty ) ; let subty = EnumSubtype :: new ( &tm Range :: ascending ( 1usize 2usize )) . unwrap () .