Struct moore_vhdl::ty2::PhysicalUnit [−][src]
Expand description
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
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)));
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);
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
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 PhysicalUnit
impl Send for PhysicalUnit
impl Sync for PhysicalUnit
impl Unpin for PhysicalUnit
impl UnwindSafe for PhysicalUnit
Blanket Implementations
Mutably borrows from an owned value. Read more