[−][src]Struct moore_vhdl::ty2::ScalarSubtype
A subtype of a scalar type.
Scalar types may be subtyped by a range constraint.
Implementations
impl<'t> ScalarSubtype<'t, dyn EnumType + 't, usize>
[src]
pub fn new(
mark: &'t TypeMark<'t>,
range: Range<usize>
) -> Option<EnumSubtype<'t>>
[src]
mark: &'t TypeMark<'t>,
range: Range<usize>
) -> Option<EnumSubtype<'t>>
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'");
impl<'t> ScalarSubtype<'t, dyn FloatingType + 't, f64>
[src]
pub fn new(
mark: &'t TypeMark<'t>,
range: Range<f64>
) -> Option<FloatingSubtype<'t>>
[src]
mark: &'t TypeMark<'t>,
range: Range<f64>
) -> Option<FloatingSubtype<'t>>
Create a new real subtype.
Returns Some(...)
if range
is a subrange of the real, or None
otherwise.
Example
use moore_common::name::get_name_table; use moore_vhdl::ty2::{Type, TypeMark, FloatingBasetype, FloatingSubtype, Range}; let ty = FloatingBasetype::new(Range::ascending(0.0, 1.0)); let tm = TypeMark::new( get_name_table().intern("UNIT", false), &ty, ); let a = FloatingSubtype::new(&tm, Range::ascending(0.0, 0.5)).unwrap(); let b = FloatingSubtype::new(&tm, Range::descending(0.5, 0.0)).unwrap(); assert_eq!(format!("{}", a), "UNIT range 0 to 0.5"); assert_eq!(format!("{}", b), "UNIT range 0.5 downto 0");
impl<'t> ScalarSubtype<'t, dyn IntegerType + 't, BigInt>
[src]
pub fn new(
mark: &'t TypeMark<'t>,
range: Range<BigInt>
) -> Option<IntegerSubtype<'t>>
[src]
mark: &'t TypeMark<'t>,
range: Range<BigInt>
) -> Option<IntegerSubtype<'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, 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");
impl<'t> ScalarSubtype<'t, dyn PhysicalType + 't, BigInt>
[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<'a, 't> Alloc<'a, 'a, ScalarSubtype<'t, dyn EnumType + 't, usize>> for TypeArena<'t> where
't: 'a,
[src]
't: 'a,
fn alloc(&'a self, value: EnumSubtype<'t>) -> &'a mut EnumSubtype<'t>
[src]
impl<'a, 't> Alloc<'a, 'a, ScalarSubtype<'t, dyn FloatingType + 't, f64>> for TypeArena<'t> where
't: 'a,
[src]
't: 'a,
fn alloc(&'a self, value: FloatingSubtype<'t>) -> &'a mut FloatingSubtype<'t>
[src]
impl<'a, 't> Alloc<'a, 'a, ScalarSubtype<'t, dyn IntegerType + 't, BigInt>> for TypeArena<'t> where
't: 'a,
[src]
't: 'a,
fn alloc(&'a self, value: IntegerSubtype<'t>) -> &'a mut IntegerSubtype<'t>
[src]
impl<'a, 't> Alloc<'a, 'a, ScalarSubtype<'t, dyn PhysicalType + 't, BigInt>> for TypeArena<'t> where
't: 'a,
[src]
't: 'a,
fn alloc(&'a self, value: PhysicalSubtype<'t>) -> &'a mut PhysicalSubtype<'t>
[src]
impl<'t, T: Type + ?Sized + 't, C: Clone> Clone for ScalarSubtype<'t, T, C>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'t, T: Debug + Type + ?Sized + 't, C: Debug + Clone> Debug for ScalarSubtype<'t, T, C>
[src]
impl<'t, T: Type + ?Sized + 't + PartialEq, C: Clone + PartialEq> Eq for ScalarSubtype<'t, T, C>
[src]
impl<'t, T: PartialEq + Type + ?Sized + 't, C: PartialEq + Clone> PartialEq<ScalarSubtype<'t, T, C>> for ScalarSubtype<'t, T, C>
[src]
fn eq(&self, other: &ScalarSubtype<'t, T, C>) -> bool
[src]
fn ne(&self, other: &ScalarSubtype<'t, T, C>) -> bool
[src]
impl<'t, T: Type + ?Sized + 't, C: Clone> StructuralPartialEq for ScalarSubtype<'t, T, C>
[src]
Auto Trait Implementations
impl<'t, T, C> !RefUnwindSafe for ScalarSubtype<'t, T, C>
impl<'t, T, C> !Send for ScalarSubtype<'t, T, C>
impl<'t, T, C> !Sync for ScalarSubtype<'t, T, C>
impl<'t, T: ?Sized, C> Unpin for ScalarSubtype<'t, T, C> where
C: Unpin,
C: Unpin,
impl<'t, T, C> !UnwindSafe for ScalarSubtype<'t, T, C>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,