Skip to main content

FpLibTableFile

Struct FpLibTableFile 

Source
pub struct FpLibTableFile;

Implementations§

Source§

impl FpLibTableFile

Source

pub fn read<P: AsRef<Path>>(path: P) -> Result<FpLibTableDocument, Error>

Examples found in repository?
examples/read_all.rs (line 27)
8fn main() -> Result<(), Box<dyn std::error::Error>> {
9    let base = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
10        .join("examples")
11        .join("data");
12
13    let pcb = PcbFile::read(base.join("sample.kicad_pcb"))?;
14    println!("pcb version: {:?}", pcb.ast().version);
15    println!("pcb unknown nodes: {}", pcb.ast().unknown_nodes.len());
16
17    let footprint = FootprintFile::read(base.join("sample.kicad_mod"))?;
18    println!("footprint version: {:?}", footprint.ast().version);
19
20    let schematic = SchematicFile::read(base.join("sample.kicad_sch"))?;
21    println!("schematic version: {:?}", schematic.ast().version);
22    println!(
23        "schematic unknown nodes: {}",
24        schematic.ast().unknown_nodes.len()
25    );
26
27    let table = FpLibTableFile::read(base.join("fp-lib-table"))?;
28    println!("fp libs: {}", table.ast().library_count);
29
30    let sym_table = SymLibTableFile::read(base.join("sym-lib-table"))?;
31    println!("sym libs: {}", sym_table.ast().library_count);
32
33    let dru = DesignRulesFile::read(base.join("sample.kicad_dru"))?;
34    println!("rules: {}", dru.ast().rule_count);
35    println!("rule constraints: {}", dru.ast().total_constraint_count);
36
37    let project = ProjectFile::read(base.join("sample.kicad_pro"))?;
38    println!("project meta version: {:?}", project.ast().meta_version);
39
40    let worksheet = WorksheetFile::read(base.join("sample.kicad_wks"))?;
41    println!("worksheet version: {:?}", worksheet.ast().version);
42    println!("worksheet tbtext count: {}", worksheet.ast().tbtext_count);
43
44    pcb.write_mode("/tmp/out.kicad_pcb", WriteMode::Lossless)?;
45    Ok(())
46}

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.