reda-lib 0.3.0

Liberty file library
Documentation
use reda_lib_macro::model;
use crate::model::LibPin;

use super::LibExpr;

#[model]
#[derive(Debug, Clone, Default)]
pub struct LibCell {
    pub name: String,
    pub pins: Vec<LibPin>,
}

#[model]
#[derive(Debug, Clone, Default)]
pub struct LibPgPin {
    pub name: String,
    pub voltage_name: String,
    pub pg_type: String,  
}

#[model]
#[derive(Debug, Clone)]
pub struct LibLeakagePower {
    pub when: LibExpr,
    pub value: f64,
}


impl LibCell {
    pub fn new<S: Into<String>>(name: S) -> Self {
        Self { 
            name: name.into(),
            ..Default::default()
        }
    }

    pub fn pin(&self, name: &str) -> Option<&LibPin> {
        self.pins.iter().find(|p| p.name == name)
    }
}