gdsr 0.0.1-alpha.3

A GDSII reader and writer for Rust
Documentation
/// A GDS layer number (0–255 in spec, stored as `u16`).
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct Layer(u16);

impl Layer {
    pub const fn new(value: u16) -> Self {
        Self(value)
    }

    pub const fn value(self) -> u16 {
        self.0
    }
}

impl std::fmt::Display for Layer {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}", self.0)
    }
}

/// A GDS data type number (0–255 in spec, stored as `u16`).
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct DataType(u16);

impl DataType {
    pub const fn new(value: u16) -> Self {
        Self(value)
    }

    pub const fn value(self) -> u16 {
        self.0
    }
}

impl std::fmt::Display for DataType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}", self.0)
    }
}

pub type AngleInRadians = f64;

/// A mapping from one (`Layer`, `DataType`) pair to another, used for bulk layer remapping.
pub type LayerMapping = std::collections::HashMap<(Layer, DataType), (Layer, DataType)>;