Struct gds::GdsUnits

source ·
pub struct GdsUnits(/* private fields */);
Expand description

An encoding of GDS units.

Each GDSII Library has two length-units, referred to as “DB Units” and “User Units” respectively. Essentially all spatial data throughout the Library is denoted in “DB Units”. “User units” are a sort of recommendation for GUI programs to use when displaying the Library.

From the spec’s UNITS record-description:

Contains two eight-byte real numbers.
The first number is the size of a database-unit, in user-units.
The second is the size of a database-unit in meters.
To calculate the size of a user-unit in meters, divide the second number by the first.

These two numbers are stored as-is in the GdsUnits tuple-struct.

Implementations§

source§

impl GdsUnits

source

pub fn new(num1: f64, num2: f64) -> Self

Creates a new GdsUnits

source

pub fn db_unit(&self) -> f64

Gets the database-unit size in meters. Used for all spatial data.

source

pub fn user_unit(&self) -> f64

Gets the user-unit size in meters. Largely for display/debug.

Trait Implementations§

source§

impl Clone for GdsUnits

source§

fn clone(&self) -> GdsUnits

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for GdsUnits

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for GdsUnits

source§

fn default() -> Self

Default values for GDS units:

  • DB-Unit = 1nm
  • User-Unit = 1µm (1000x the DB-Unit)
source§

impl<'de> Deserialize<'de> for GdsUnits

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq for GdsUnits

source§

fn eq(&self, other: &GdsUnits) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for GdsUnits

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl StructuralPartialEq for GdsUnits

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,