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
impl PcbDocument
Sourcepub fn parse(source: String, limits: PcbLimits) -> Result<Self, Error>
pub fn parse(source: String, limits: PcbLimits) -> Result<Self, Error>
Validate and own one UTF-8 kicad_pcb source buffer.
Sourcepub fn from_reader(reader: impl Read, limits: PcbLimits) -> Result<Self, Error>
pub fn from_reader(reader: impl Read, limits: PcbLimits) -> Result<Self, Error>
Read at most the configured source ceiling plus one sentinel byte.
pub fn source(&self) -> &str
pub fn into_source(self) -> String
pub fn limits(&self) -> PcbLimits
Sourcepub fn view(&self) -> Result<PcbView<'_>, Error>
pub fn view(&self) -> Result<PcbView<'_>, Error>
Build a fresh source-backed view over the current owned text.
Sourcepub fn view_selected(
&self,
selection: PcbSelection,
) -> Result<PcbView<'_>, Error>
pub fn view_selected( &self, selection: PcbSelection, ) -> Result<PcbView<'_>, Error>
Build a dependency-aware selected view over the current source.
Sourcepub fn write_to(&self, writer: impl Write) -> Result<(), Error>
pub fn write_to(&self, writer: impl Write) -> Result<(), Error>
Write the current source verbatim after checking the output ceiling.
Sourcepub fn set_property(&mut self, name: &str, value: &str) -> Result<bool, Error>
pub fn set_property(&mut self, name: &str, value: &str) -> Result<bool, Error>
Replace one unambiguous board property and reparse before committing.
Sourcepub fn upsert_property(
&mut self,
name: &str,
value: &str,
) -> Result<bool, Error>
pub fn upsert_property( &mut self, name: &str, value: &str, ) -> Result<bool, Error>
Update or create one board property and reparse before committing.
Sourcepub fn remove_property(&mut self, name: &str) -> Result<bool, Error>
pub fn remove_property(&mut self, name: &str) -> Result<bool, Error>
Remove one board property and reparse before committing.
Trait Implementations§
Source§impl Clone for PcbDocument
impl Clone for PcbDocument
Source§fn clone(&self) -> PcbDocument
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PcbDocument
impl RefUnwindSafe for PcbDocument
impl Send for PcbDocument
impl Sync for PcbDocument
impl Unpin for PcbDocument
impl UnsafeUnpin for PcbDocument
impl UnwindSafe for PcbDocument
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more