[][src]Type Definition moore_vhdl::ty2::FloatingSubtype

type FloatingSubtype<'t> = ScalarSubtype<'t, dyn FloatingType, f64>;

A subtype of an real type.

Implementations

impl<'t> FloatingSubtype<'t>[src]

pub fn new(
    mark: &'t TypeMark<'t>,
    range: Range<f64>
) -> Option<FloatingSubtype<'t>>
[src]

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

impl<'t> Display for FloatingSubtype<'t>[src]

impl<'t> FloatingType for FloatingSubtype<'t>[src]

impl<'t> Type for FloatingSubtype<'t>[src]