[][src]Struct moore_vhdl::ty2::PhysicalUnit

pub struct PhysicalUnit {
    pub name: Name,
    pub abs: BigInt,
    pub rel: Option<(BigInt, usize)>,
}

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]

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]

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]

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]

impl Debug for PhysicalUnit[src]

impl Eq for PhysicalUnit[src]

impl PartialEq<PhysicalUnit> for PhysicalUnit[src]

impl StructuralEq for PhysicalUnit[src]

impl StructuralPartialEq for PhysicalUnit[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.