[−][src]Struct moore_vhdl::ty2::PhysicalUnit
A unit of a physical type.
Fields
name: Name
The name of the unit.
abs: BigInt
The scale of the unit with respect to the physical type's primary unit.
rel: Option<(BigInt, usize)>
The scale of the unit with respect to another unit.
Implementations
impl PhysicalUnit
[src]
pub fn new<A, R>(name: Name, abs: A, rel: Option<(R, usize)>) -> PhysicalUnit where
BigInt: From<A> + From<R>,
[src]
BigInt: From<A> + From<R>,
Create a new unit.
Example
use moore_vhdl::ty2::{PhysicalUnit, BigInt}; use moore_common::name::get_name_table; let name = get_name_table().intern("fs", false); let unit = PhysicalUnit::new(name, 1, Some((1000, 0))); assert_eq!(unit.name, name); assert_eq!(unit.abs, BigInt::from(1)); assert_eq!(unit.rel, Some((BigInt::from(1000), 0)));
pub fn primary<A>(name: Name, abs: A) -> PhysicalUnit where
BigInt: From<A>,
[src]
BigInt: From<A>,
Create a new primary unit.
Example
use moore_vhdl::ty2::{PhysicalUnit, BigInt}; use moore_common::name::get_name_table; let name = get_name_table().intern("fs", false); let unit = PhysicalUnit::primary(name, 1); assert_eq!(unit.name, name); assert_eq!(unit.abs, BigInt::from(1)); assert_eq!(unit.rel, None);
pub fn secondary<A, R>(
name: Name,
abs: A,
rel: R,
rel_to: usize
) -> PhysicalUnit where
BigInt: From<A> + From<R>,
[src]
name: Name,
abs: A,
rel: R,
rel_to: usize
) -> PhysicalUnit where
BigInt: From<A> + From<R>,
Create a new secondary unit.
Example
use moore_vhdl::ty2::{PhysicalUnit, BigInt}; use moore_common::name::get_name_table; let name = get_name_table().intern("fs", false); let unit = PhysicalUnit::secondary(name, 1, 1000, 0); assert_eq!(unit.name, name); assert_eq!(unit.abs, BigInt::from(1)); assert_eq!(unit.rel, Some((BigInt::from(1000), 0)));
Trait Implementations
impl Clone for PhysicalUnit
[src]
fn clone(&self) -> PhysicalUnit
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for PhysicalUnit
[src]
impl Eq for PhysicalUnit
[src]
impl PartialEq<PhysicalUnit> for PhysicalUnit
[src]
fn eq(&self, other: &PhysicalUnit) -> bool
[src]
fn ne(&self, other: &PhysicalUnit) -> bool
[src]
impl StructuralEq for PhysicalUnit
[src]
impl StructuralPartialEq for PhysicalUnit
[src]
Auto Trait Implementations
impl RefUnwindSafe for PhysicalUnit
impl Send for PhysicalUnit
impl Sync for PhysicalUnit
impl Unpin for PhysicalUnit
impl UnwindSafe for PhysicalUnit
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, 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>,