memea::db

Function build_db

Source
pub fn build_db(filename: &PathBuf) -> Result<Database, MemeaError>
Expand description

Builds a database by deserializing from a YAML or JSON file.

§Arguments

  • filename - Path to the database file to load

§Returns

  • Ok(Database) - Successfully loaded database
  • Err(MemeaError) - File I/O error, parsing error, or unsupported format

§Examples

use memea::db::build_db;
use std::path::PathBuf;

let db_path = PathBuf::from("my_components.yaml");
match build_db(&db_path) {
    Ok(database) => println!("Loaded {} core cells", database.core.len()),
    Err(e) => eprintln!("Failed to load database: {}", e),
}