Skip to main content

SelectorEngine

Struct SelectorEngine 

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

Query execution engine for schematic records.

The engine operates on a RecordTree<SchRecord> and provides methods to execute selector queries against the tree.

Implementations§

Source§

impl<'a> SelectorEngine<'a>

Source

pub fn new(tree: &'a RecordTree<SchRecord>) -> Self

Create a new selector engine for the given record tree.

Source

pub fn set_sheet_name(&mut self, sheet_id: RecordId, name: String)

Set the sheet name for a specific sheet header. This should be called with the document name (filename without extension), not the Title parameter which is typically the project title.

Source

pub fn set_document_name(&mut self, name: String)

Set the sheet name for all sheet headers in the tree. Convenience method for single-sheet documents where the document name applies to the single SheetHeader record.

Source

pub fn query(&self, selector: &Selector) -> Vec<QueryMatch>

Execute a selector query and return matching record IDs.

Source

pub fn get_component_designator(&self, id: RecordId) -> Option<&str>

Get the designator of a component by ID.

Source

pub fn get_component_value(&self, id: RecordId) -> Option<&str>

Get the value of a component by ID.

Source

pub fn get_component_part_number(&self, id: RecordId) -> Option<&str>

Get the part number (lib_reference) of a component by ID.

Auto Trait Implementations§

§

impl<'a> Freeze for SelectorEngine<'a>

§

impl<'a> RefUnwindSafe for SelectorEngine<'a>

§

impl<'a> Send for SelectorEngine<'a>

§

impl<'a> Sync for SelectorEngine<'a>

§

impl<'a> Unpin for SelectorEngine<'a>

§

impl<'a> UnwindSafe for SelectorEngine<'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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. 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.
Source§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool