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

PcbView

Struct PcbView 

Source
pub struct PcbView<'a> { /* private fields */ }
Expand description

A board view backed by one source buffer and exact selected form spans.

Implementations§

Source§

impl<'a> PcbView<'a>

Source

pub fn paper(&self) -> Result<KiCadPaper, Error>

Return the board paper declaration, or KiCad Monkey’s Python-compatible A4 default when the form is absent.

Source

pub fn title_block(&self) -> Result<Option<KiCadTitleBlock>, Error>

Decode the first board title block using the same close-to-format record that the schematic reader will consume.

Source

pub fn declared_board_thickness(&self) -> Result<Option<f64>, Error>

Exact authored nominal board thickness, without the effective metadata default.

Source

pub fn metadata(&self) -> Result<PcbBoardMetadata, Error>

Source

pub fn variants( &self, ) -> impl Iterator<Item = Result<PcbBoardVariant, Error>> + '_

Source

pub fn images(&self) -> impl Iterator<Item = Result<PcbImage, Error>> + '_

Source

pub fn barcodes(&self) -> impl Iterator<Item = Result<PcbBarcode, Error>> + '_

Source

pub fn tables(&self) -> impl Iterator<Item = Result<PcbTable, Error>> + '_

Source

pub fn table_cells( &self, ) -> impl Iterator<Item = Result<PcbTableCell, Error>> + '_

Source

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

Replace the existing layer of one uniquely identified top-level form.

Source§

impl PcbView<'_>

Source

pub fn annular_ring_stats(&self) -> Result<PcbAnnularRingStats, Error>

Observe through-hole pad and via rings using authored size/drill dimensions. Pads are visited before vias. NPTH/SMD pads and negative isolated helper-pad rings are excluded; zero survives. Drill offsets, custom copper unions and layer-dependent padstacks do not alter this source-envelope statistic. The existing reader limits apply; both selected families are required.

Source§

impl<'a> PcbView<'a>

Source

pub fn footprint_properties( &self, ) -> impl Iterator<Item = Result<PcbFootprintProperty, Error>> + '_

Iterate requested footprint properties in board and child source order.

Source

pub fn footprint_graphics( &self, ) -> impl Iterator<Item = Result<PcbFootprintGraphic, Error>> + '_

Iterate requested non-text footprint graphics in board and child source order.

Source

pub fn footprint_texts( &self, ) -> impl Iterator<Item = Result<PcbFootprintText, Error>> + '_

Iterate footprint-local text in board and child source order.

Source

pub fn footprint_text_boxes( &self, ) -> impl Iterator<Item = Result<PcbFootprintTextBox, Error>> + '_

Iterate footprint-local text boxes in board and child source order.

Source§

impl<'a> PcbView<'a>

Source

pub fn holes(&self) -> impl Iterator<Item = Result<PcbHole, Error>> + '_

Iterate source-authored holes: footprint-local pad drills, then board vias.

Source

pub fn footprint_transforms( &self, ) -> impl Iterator<Item = Result<PcbFootprintTransform, Error>> + '_

Iterate explicit footprint-local to board placement facts in source order.

Source

pub fn profile_primitives( &self, ) -> impl Iterator<Item = Result<PcbProfilePrimitive, Error>> + '_

Iterate top-level and footprint-local Edge.Cuts carriers.

Source§

impl PcbView<'_>

Source

pub fn effective_footprint_primary_batch( &self, footprint_index: usize, ) -> Result<PcbFootprintPrimaryBatch, Error>

Acquire ordered primary history once, then reduce each graphical slot independently with the existing reducer. Acquisition validates all primary leaves before any drawing capability error can be recovered. Original declarations, reader limits and singular operations are unchanged.

Source§

impl PcbView<'_>

Source§

impl<'a> PcbView<'a>

Source

pub fn setup_tenting(&self) -> Result<Option<PcbFrontBackOptionalBool>, Error>

Authored setup tenting flags; absence differs from an explicit no. Existing effective setup defaults remain available through setup.

Source

pub fn effective_auxiliary_origin(&self) -> Result<PcbPoint, Error>

Effective KiCad auxiliary datum in CAD coordinates, including the zero default. An absent declaration/setup does not become authored evidence.

Source

pub fn setup(&self) -> Result<Option<PcbSetup>, Error>

Source

pub fn effective_setup(&self) -> Result<PcbSetup, Error>

The authored setup, or KiCad’s defaults when the board has no (setup) form: pcbnew loads such a board with its default design settings.

Source

pub fn effective_layers(&self) -> Result<Vec<PcbLayer>, Error>

The declared board layers, or KiCad’s default board layers when the file has no (layers) form, as pcbnew loads and saves such a board. Default rows have an empty source range.

Source§

impl PcbView<'_>

Source

pub fn dimension_text( &self, index: usize, ) -> Result<Option<PcbBoardText>, Error>

Read the actual nested text of a selected dimension through the existing source text decoder. The index belongs to dimensions() source order.

Source

pub fn board_texts( &self, ) -> impl Iterator<Item = Result<PcbBoardText, Error>> + '_

Read selected board text in source order without invoking the plotter. Cache presence is retained even when a plotter would reject its content.

Source

pub fn board_text_boxes( &self, ) -> impl Iterator<Item = Result<PcbBoardTextBox, Error>> + '_

Read selected board text boxes in source order; the index is the graphic’s position among all board graphics, as for board text.

Source§

impl PcbView<'_>

Source

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

Remove one unambiguous identified top-level object by uuid or legacy id.

Source

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

Replace one unambiguous top-level board property without rewriting the board.

Source

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

Update or append one unambiguous top-level board property.

Source

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

Remove one unambiguous top-level board property by name.

Source§

impl PcbView<'_>

Source

pub fn embedded_files( &self, ) -> impl Iterator<Item = Result<PcbEmbeddedFile, Error>> + '_

Iterate board-owned embedded resources in source order.

This preserves the pre-existing board-scope behavior. Use Self::footprint_embedded_files or Self::all_embedded_files for nested declarations.

Source

pub fn footprint_embedded_files( &self, ) -> impl Iterator<Item = Result<PcbEmbeddedFile, Error>> + '_

Iterate footprint-owned embedded resources in board and child source order.

Source

pub fn all_embedded_files( &self, ) -> impl Iterator<Item = Result<PcbEmbeddedFile, Error>> + '_

Iterate all board and embedded-footprint resource declarations.

Source

pub fn embedded_file_encoded_data( &self, file: &PcbEmbeddedFile, maximum: usize, ) -> Result<Option<String>, Error>

Return the exact joined base64 payload without decoding it.

None means no (data ...) form was authored; Some("") is an explicitly empty payload.

Source

pub fn decode_embedded_file( &self, file: &PcbEmbeddedFile, ) -> Result<Option<Vec<u8>>, Error>

Decode and checksum-verify one zstd/base64 payload on demand.

Source§

impl<'a> PcbView<'a>

Source

pub fn parse(source: &'a str, limits: PcbLimits) -> Result<Self, Error>

Validate one kicad_pcb root and index its major domain families.

Source

pub fn parse_selected( source: &'a str, limits: PcbLimits, selection: PcbSelection, ) -> Result<Self, Error>

Validate a board and index only the requested families plus dependencies.

Source

pub fn counts(&self) -> PcbCounts

Source

pub fn source(&self) -> &'a str

Source

pub fn selection(&self) -> PcbSelection

Source

pub fn root_span(&self) -> &FormSpan

Source

pub fn top_level_forms(&self) -> impl Iterator<Item = &FormSpan>

Iterate exact top-level spans in source order, including unknown forms.

Source

pub fn unknown_top_level_forms(&self) -> impl Iterator<Item = &FormSpan>

Source

pub fn layers(&self) -> impl Iterator<Item = Result<PcbLayer, Error>> + '_

Source

pub fn nets(&self) -> impl Iterator<Item = Result<PcbNet, Error>> + '_

Source

pub fn properties( &self, ) -> impl Iterator<Item = Result<PcbProperty, Error>> + '_

Source

pub fn footprints( &self, ) -> impl Iterator<Item = Result<PcbFootprint, Error>> + '_

Source

pub fn pads(&self) -> impl Iterator<Item = Result<PcbPad, Error>> + '_

Source

pub fn models( &self, ) -> impl Iterator<Item = Result<PcbModelReference, Error>> + '_

Source

pub fn segments(&self) -> impl Iterator<Item = Result<PcbSegment, Error>> + '_

Source

pub fn vias(&self) -> impl Iterator<Item = Result<PcbVia, Error>> + '_

Source

pub fn zones(&self) -> impl Iterator<Item = Result<PcbZone, Error>> + '_

Source

pub fn footprint_zones( &self, ) -> impl Iterator<Item = Result<PcbFootprintZone, Error>> + '_

Iterate requested footprint-owned zones and rule areas in board and child source order. KiCad stores their outlines in board coordinates.

Source

pub fn graphics(&self) -> impl Iterator<Item = Result<PcbGraphic, Error>> + '_

Source

pub fn arcs(&self) -> impl Iterator<Item = Result<PcbRoutingArc, Error>> + '_

Source

pub fn dimensions( &self, ) -> impl Iterator<Item = Result<PcbDimension, Error>> + '_

Source

pub fn groups(&self) -> impl Iterator<Item = Result<PcbGroup, Error>> + '_

Source

pub fn generated_items( &self, ) -> impl Iterator<Item = Result<PcbGeneratedItem, Error>> + '_

Source§

impl PcbView<'_>

Source

pub fn locate_footprint_features( &self, selectors: &[PcbFootprintFeatureSelector], ) -> Result<PcbLocatedFeatures, Error>

Resolve exact effective Reference and exact opaque graphic UUID/tstamp tokens. Missing or ambiguous optional selectors diagnose their own scope; native read errors propagate.

Trait Implementations§

Source§

impl<'a> Clone for PcbView<'a>

Source§

fn clone(&self) -> PcbView<'a>

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<'a> Debug for PcbView<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for PcbView<'a>

§

impl<'a> RefUnwindSafe for PcbView<'a>

§

impl<'a> Send for PcbView<'a>

§

impl<'a> Sync for PcbView<'a>

§

impl<'a> Unpin for PcbView<'a>

§

impl<'a> UnsafeUnpin for PcbView<'a>

§

impl<'a> UnwindSafe for PcbView<'a>

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.