Skip to main content
← Back to kicad-monkey Rust Docs kicad-monkey Rust Crate API Reference

PcbDocument

Struct PcbDocument 

Source
pub struct PcbDocument { /* private fields */ }
Expand description

An owned KiCad board document.

The document owns only source text and limits. Each PcbDocument::view borrows that text and builds the bounded structural index, avoiding a self-referential object and keeping unknown forms byte-preserved.

Implementations§

Source§

impl PcbDocument

Source

pub fn parse(source: String, limits: PcbLimits) -> Result<Self, Error>

Validate and own one UTF-8 kicad_pcb source buffer.

Source

pub fn from_reader(reader: impl Read, limits: PcbLimits) -> Result<Self, Error>

Read at most the configured source ceiling plus one sentinel byte.

Source

pub fn source(&self) -> &str

Source

pub fn into_source(self) -> String

Source

pub fn limits(&self) -> PcbLimits

Source

pub fn view(&self) -> Result<PcbView<'_>, Error>

Build a fresh source-backed view over the current owned text.

Source

pub fn view_selected( &self, selection: PcbSelection, ) -> Result<PcbView<'_>, Error>

Build a dependency-aware selected view over the current source.

Source

pub fn write_to(&self, writer: impl Write) -> Result<(), Error>

Write the current source verbatim after checking the output ceiling.

Source

pub fn set_property(&mut self, name: &str, value: &str) -> Result<bool, Error>

Replace one unambiguous board property and reparse before committing.

Source

pub fn upsert_property( &mut self, name: &str, value: &str, ) -> Result<bool, Error>

Update or create one board property and reparse before committing.

Source

pub fn remove_property(&mut self, name: &str) -> Result<bool, Error>

Remove one board property and reparse before committing.

Source

pub fn remove_top_level_by_id( &mut self, identifier: &str, ) -> Result<bool, Error>

Remove one unambiguous identified top-level form and reparse before committing.

Source

pub fn set_top_level_layer_by_id( &mut self, identifier: &str, layer: &str, ) -> Result<bool, Error>

Replace one identified top-level object’s singular layer field.

Trait Implementations§

Source§

impl Clone for PcbDocument

Source§

fn clone(&self) -> PcbDocument

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PcbDocument

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.