Skip to main content

Module interpreter

Module interpreter 

Source
Expand description

§interpreter Module

This module provides functionality to interpret parsed ASUS FZ and ASRock CAE files into structured footprint data.

§Usage Example

use std::fs::File;
use std::io::BufReader;

use pcbrepair::decoder::DecodedPcbRepairFile;
use pcbrepair::parser::ParsedPcbRepairFile;
use pcbrepair::interpreter::InterpretedPcbRepairFile;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Open the file
    let file = File::open("example.fz")?;
    let reader = BufReader::new(file);

    // Decode the file
    let decoded = DecodedPcbRepairFile::new(reader)?;

    // Parse the decoded file
    let parsed = ParsedPcbRepairFile::from_decoded(&decoded)?;

    // Interpret the parsed file
    let interpreted = InterpretedPcbRepairFile::from_parsed(&parsed)?;

    // Access interpreted footprints
    for (name, info) in &interpreted.footprints {
        println!("Footprint: {}", name);
        for pin in &info.pins {
            println!("  Pin: {} at ({}, {})", pin.number, pin.x_mm, pin.y_mm);
        }
    }

    Ok(())
}

Structs§

FootprintInfo
Information about a footprint, including its pins.
InterpretedPcbRepairFile
A fully interpreted PCB repair file, containing footprint data.
Pin
Represents a pin in a footprint.