Struct moore_vhdl::ty2::FloatingBasetype [−][src]
pub struct FloatingBasetype { /* fields omitted */ }
Expand description
A real base type.
Implementations
Create a new real type.
Example
use moore_vhdl::ty2::{Type, FloatingBasetype, Range, RangeDir};
let a = FloatingBasetype::new(Range::ascending(0, 42));
let b = FloatingBasetype::new(Range::descending(42, 0));
assert_eq!(format!("{}", a), "0 to 42");
assert_eq!(format!("{}", b), "42 downto 0");
assert_eq!(a.dir(), RangeDir::To);
assert_eq!(b.dir(), RangeDir::Downto);
assert_eq!(a.len(), 43 as f64);
assert_eq!(b.len(), 43 as f64);
Methods from Deref<Target = Range<f64>>
Return the direction of the range.
Example
use moore_vhdl::ty2::{IntegerRange, RangeDir};
let a = IntegerRange::ascending(0, 42);
let b = IntegerRange::descending(42, 0);
assert_eq!(a.dir(), RangeDir::To);
assert_eq!(b.dir(), RangeDir::Downto);
Return the left bound of the range.
Example
use moore_vhdl::ty2::{IntegerRange, BigInt};
let a = IntegerRange::ascending(0, 42);
let b = IntegerRange::descending(42, 0);
assert_eq!(a.left(), &BigInt::from(0));
assert_eq!(b.left(), &BigInt::from(42));
Return the right bound of the range.
Example
use moore_vhdl::ty2::{IntegerRange, BigInt};
let a = IntegerRange::ascending(0, 42);
let b = IntegerRange::descending(42, 0);
assert_eq!(a.right(), &BigInt::from(42));
assert_eq!(b.right(), &BigInt::from(0));
Return the lower bound of the range.
Example
use moore_vhdl::ty2::{IntegerRange, BigInt};
let a = IntegerRange::ascending(0, 42);
let b = IntegerRange::descending(42, 0);
assert_eq!(a.lower(), &BigInt::from(0));
assert_eq!(b.lower(), &BigInt::from(0));
Return the upper bound of the range.
Example
use moore_vhdl::ty2::{IntegerRange, BigInt};
let a = IntegerRange::ascending(0, 42);
let b = IntegerRange::descending(42, 0);
assert_eq!(a.upper(), &BigInt::from(42));
assert_eq!(b.upper(), &BigInt::from(42));
Return true if the range is a null range.
A null range has its lower bound greater than or equal to its upper bound, and thus also a length of 0 or lower.
Example
use moore_vhdl::ty2::IntegerRange;
let a = IntegerRange::ascending(0, 42);
let b = IntegerRange::ascending(42, 0);
assert_eq!(a.is_null(), false);
assert_eq!(b.is_null(), true);
Return the length of the range.
The length of a range is defined as upper + 1 - lower
. The result may
be negative, indicating that the range is a null range.
Example
use moore_vhdl::ty2::{IntegerRange, BigInt};
let a = IntegerRange::ascending(0, 42);
let b = IntegerRange::ascending(42, 0);
assert_eq!(a.len(), BigInt::from(43));
assert_eq!(b.len(), BigInt::from(-41));
Check if another range is a subrange of this range.
This function checks if self.lower()
is less than or equal to, and
self.upper()
is larger than or equal to, the corresponding bounds of
the subrange.
Example
use moore_vhdl::ty2::{IntegerRange, BigInt};
let a = IntegerRange::ascending(0, 42);
let b = IntegerRange::ascending(4, 16);
let c = IntegerRange::descending(16, 4);
assert_eq!(a.has_subrange(&b), true);
assert_eq!(a.has_subrange(&c), true);
assert_eq!(b.has_subrange(&a), false);
assert_eq!(c.has_subrange(&a), false);
assert_eq!(b.has_subrange(&c), true);
assert_eq!(c.has_subrange(&b), true);
Trait Implementations
Allocate a value of type T
.
Returns Some
if self is an FloatingBasetype
, None
otherwise.
Check if two real types are equal.
The resolution function associated with this type.
Returns Some
if self is an FloatingSubtype
, 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.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for FloatingBasetype
impl Send for FloatingBasetype
impl Sync for FloatingBasetype
impl Unpin for FloatingBasetype
impl UnwindSafe for FloatingBasetype
Blanket Implementations
Mutably borrows from an owned value. Read more