pub struct PartQuery {
pub component_type: Option<ComponentType>,
pub package: Option<String>,
pub parameters: HashMap<String, ParameterConstraint>,
pub min_stock: Option<u32>,
pub basic_only: bool,
pub limit: Option<usize>,
}Expand description
A query for finding parts in a database.
Fields§
§component_type: Option<ComponentType>The component type to search for.
package: Option<String>Package filter (e.g., “0402”, “0603”).
parameters: HashMap<String, ParameterConstraint>Parameter constraints.
min_stock: Option<u32>Minimum stock required.
basic_only: boolOnly include basic/preferred parts.
limit: Option<usize>Maximum number of results.
Implementations§
Source§impl PartQuery
impl PartQuery
Sourcepub fn for_type(component_type: ComponentType) -> Self
pub fn for_type(component_type: ComponentType) -> Self
Create a query for a specific component type.
Sourcepub fn with_package(self, package: impl Into<String>) -> Self
pub fn with_package(self, package: impl Into<String>) -> Self
Set the package filter.
Sourcepub fn with_param(
self,
name: impl Into<String>,
constraint: ParameterConstraint,
) -> Self
pub fn with_param( self, name: impl Into<String>, constraint: ParameterConstraint, ) -> Self
Add a parameter constraint.
Sourcepub fn with_resistance(self, constraint: ParameterConstraint) -> Self
pub fn with_resistance(self, constraint: ParameterConstraint) -> Self
Add a resistance constraint (for resistors).
Sourcepub fn with_capacitance(self, constraint: ParameterConstraint) -> Self
pub fn with_capacitance(self, constraint: ParameterConstraint) -> Self
Add a capacitance constraint (for capacitors).
Sourcepub fn with_inductance(self, constraint: ParameterConstraint) -> Self
pub fn with_inductance(self, constraint: ParameterConstraint) -> Self
Add an inductance constraint (for inductors).
Sourcepub fn with_voltage(self, constraint: ParameterConstraint) -> Self
pub fn with_voltage(self, constraint: ParameterConstraint) -> Self
Add a voltage rating constraint.
Sourcepub fn with_power(self, constraint: ParameterConstraint) -> Self
pub fn with_power(self, constraint: ParameterConstraint) -> Self
Add a power rating constraint.
Sourcepub fn with_tolerance(self, constraint: ParameterConstraint) -> Self
pub fn with_tolerance(self, constraint: ParameterConstraint) -> Self
Add a tolerance constraint.
Sourcepub fn with_min_stock(self, stock: u32) -> Self
pub fn with_min_stock(self, stock: u32) -> Self
Set minimum stock.
Sourcepub fn basic_only(self) -> Self
pub fn basic_only(self) -> Self
Only include basic/preferred parts.
Sourcepub fn with_limit(self, limit: usize) -> Self
pub fn with_limit(self, limit: usize) -> Self
Set result limit.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PartQuery
impl<'de> Deserialize<'de> for PartQuery
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PartQuery
impl RefUnwindSafe for PartQuery
impl Send for PartQuery
impl Sync for PartQuery
impl Unpin for PartQuery
impl UnwindSafe for PartQuery
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