Type Definition moore_vhdl::ty2::FloatingSubtype [−][src]
pub type FloatingSubtype<'t> = ScalarSubtype<'t, dyn FloatingType, f64>;
Expand description
A subtype of an real type.
Implementations
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");
Trait Implementations
Returns Some
if self is an FloatingSubtype
, None
otherwise.
Check if two real types are equal.
The resolution function associated with this type.
Returns Some
if self is an FloatingBasetype
, None
otherwise.
Checks whether this is a universal real type.
Returns an &FloatingBasetype
or panics if the type is not a basetype.
Returns an &FloatingSubtype
or panics if the type is not a subtype.