Struct moore_vhdl::ty2::FloatingBasetype
source · [−]pub struct FloatingBasetype { /* private fields */ }
Expand description
A real base type.
Implementations
sourceimpl FloatingBasetype
impl FloatingBasetype
sourcepub fn new(range: Range<f64>) -> FloatingBasetype
pub fn new(range: Range<f64>) -> FloatingBasetype
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>>
sourcepub fn dir(&self) -> RangeDir
pub fn dir(&self) -> RangeDir
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);
sourcepub fn left(&self) -> &T
pub fn left(&self) -> &T
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));
sourcepub fn right(&self) -> &T
pub fn right(&self) -> &T
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));
sourcepub fn lower(&self) -> &T
pub fn lower(&self) -> &T
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));
sourcepub fn upper(&self) -> &T
pub fn upper(&self) -> &T
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));
sourcepub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
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);
sourcepub fn len(&self) -> T
pub fn len(&self) -> T
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));
sourcepub fn has_subrange(&self, subrange: &Self) -> bool
pub fn has_subrange(&self, subrange: &Self) -> bool
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
sourceimpl<'a, 't> Alloc<'a, 'a, FloatingBasetype> for TypeArena<'t> where
't: 'a,
impl<'a, 't> Alloc<'a, 'a, FloatingBasetype> for TypeArena<'t> where
't: 'a,
sourcefn alloc(&'a self, value: FloatingBasetype) -> &'a mut FloatingBasetype
fn alloc(&'a self, value: FloatingBasetype) -> &'a mut FloatingBasetype
Allocate a value of type T
.
sourceimpl Clone for FloatingBasetype
impl Clone for FloatingBasetype
sourcefn clone(&self) -> FloatingBasetype
fn clone(&self) -> FloatingBasetype
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for FloatingBasetype
impl Debug for FloatingBasetype
sourceimpl Deref for FloatingBasetype
impl Deref for FloatingBasetype
sourceimpl Display for FloatingBasetype
impl Display for FloatingBasetype
sourceimpl FloatingType for FloatingBasetype
impl FloatingType for FloatingBasetype
sourcefn as_basetype(&self) -> Option<&FloatingBasetype>
fn as_basetype(&self) -> Option<&FloatingBasetype>
Returns Some
if self is an FloatingBasetype
, None
otherwise.
sourcefn is_equal(&self, other: &dyn FloatingType) -> bool
fn is_equal(&self, other: &dyn FloatingType) -> bool
Check if two real types are equal.
sourcefn resolution_func(&self) -> Option<usize>
fn resolution_func(&self) -> Option<usize>
The resolution function associated with this type.
sourcefn as_subtype(&self) -> Option<&FloatingSubtype<'_>>
fn as_subtype(&self) -> Option<&FloatingSubtype<'_>>
Returns Some
if self is an FloatingSubtype
, None
otherwise.
sourcefn is_universal(&self) -> bool
fn is_universal(&self) -> bool
Checks whether this is a universal real type.
sourcefn unwrap_basetype(&self) -> &FloatingBasetype
fn unwrap_basetype(&self) -> &FloatingBasetype
Returns an &FloatingBasetype
or panics if the type is not a basetype.
sourcefn unwrap_subtype(&self) -> &FloatingSubtype<'_>
fn unwrap_subtype(&self) -> &FloatingSubtype<'_>
Returns an &FloatingSubtype
or panics if the type is not a subtype.
sourceimpl PartialEq<FloatingBasetype> for FloatingBasetype
impl PartialEq<FloatingBasetype> for FloatingBasetype
sourcefn eq(&self, other: &FloatingBasetype) -> bool
fn eq(&self, other: &FloatingBasetype) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &FloatingBasetype) -> bool
fn ne(&self, other: &FloatingBasetype) -> bool
This method tests for !=
.
sourceimpl Type for FloatingBasetype
impl Type for FloatingBasetype
sourcefn is_discrete(&self) -> bool
fn is_discrete(&self) -> bool
Check if this is a discrete type. Read more
sourcefn is_numeric(&self) -> bool
fn is_numeric(&self) -> bool
Check if this is a numeric type. Read more
sourcefn is_composite(&self) -> bool
fn is_composite(&self) -> bool
Check if this is a composite type. Read more
sourcefn into_owned<'a>(self) -> OwnedType<'a> where
Self: 'a,
fn into_owned<'a>(self) -> OwnedType<'a> where
Self: 'a,
Convert into an owned type.
sourcefn is_implicitly_castable(&self, _into: &dyn Type) -> bool
fn is_implicitly_castable(&self, _into: &dyn Type) -> bool
Check if the type can be implicitly cast to another.
impl Eq for FloatingBasetype
impl StructuralPartialEq for FloatingBasetype
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more