pub struct Database {
pub core: HashMap<String, Core>,
pub logic: HashMap<String, Logic>,
pub switch: HashMap<String, Switch>,
pub adc: HashMap<String, ADC>,
}Expand description
Component database containing all available peripheral elements.
The database stores collections of different component types (core cells, logic blocks, switches, and ADCs) indexed by name. It supports serialization to and from YAML and JSON formats.
§Examples
use memea::db::{Database, build_db};
use std::path::PathBuf;
// Load database from file
let db_path = PathBuf::from("components.yaml");
let db = build_db(&db_path).expect("Failed to load database");
// Access components
if let Some(core_cell) = db.core.get("sram_6t") {
println!("Found core cell with WL drive: {}", core_cell.dx_wl);
}Fields§
§core: HashMap<String, Core>Collection of memory core cells indexed by name.
logic: HashMap<String, Logic>Collection of logic blocks indexed by name.
switch: HashMap<String, Switch>Collection of switch components indexed by name.
adc: HashMap<String, ADC>Collection of ADC components indexed by name.
Implementations§
Source§impl Database
impl Database
Sourcepub fn add_adc(&mut self, name: &str, dims: Dims)
pub fn add_adc(&mut self, name: &str, dims: Dims)
Adds a new ADC component to the database via interactive prompts.
§Arguments
name- Name identifier for the ADCdims- Physical dimensions of the ADC
Sourcepub fn add_core(&mut self, name: &str, dims: Dims)
pub fn add_core(&mut self, name: &str, dims: Dims)
Adds a new core cell to the database via interactive prompts.
§Arguments
name- Name identifier for the core celldims- Physical dimensions of the core cell
Sourcepub fn add_logic(&mut self, name: &str, dims: Dims)
pub fn add_logic(&mut self, name: &str, dims: Dims)
Adds a new logic block to the database via interactive prompts.
§Arguments
name- Name identifier for the logic blockdims- Physical dimensions of the logic block
Sourcepub fn add_switch(&mut self, name: &str, dims: Dims)
pub fn add_switch(&mut self, name: &str, dims: Dims)
Adds a new switch component to the database via interactive prompts.
§Arguments
name- Name identifier for the switchdims- Physical dimensions of the switch
Sourcepub fn save(&self, filename: &PathBuf, verbose: bool) -> Result<(), MemeaError>
pub fn save(&self, filename: &PathBuf, verbose: bool) -> Result<(), MemeaError>
Saves the database to a file in YAML or JSON format.
The output format is determined by the file extension (.yaml/.yml for YAML, .json for JSON).
§Arguments
filename- Path where the database should be savedverbose- Whether to print verbose output about the save operation
§Returns
Ok(())- Database was successfully savedErr(MemeaError)- File I/O error or unsupported format