Expand description
Part database interface for the Ato electronics compiler.
This crate provides traits and types for querying electronic component databases like JLCPCB/LCSC, Digikey, and others. It enables part selection based on solved parameter constraints from the constraint solver.
§Overview
The part selection process works as follows:
- The constraint solver produces parameter bounds (e.g., resistance within 9.5k-10.5k ohm)
- A
PartQueryis constructed from these constraints - A
PartDatabaseimplementation queries a parts API or local database - A
PartSelectorscores and ranks the matching parts - The best matching part is selected
§Main Types
Part- A component part with parameters, package, and availability infoPartId- Unique identifier for a part (supplier + part number)PartQuery- Query criteria for finding matching partsPartDatabase- Trait for querying part databasesPartSelector- Trait for ranking/selecting partsLcscClient- LCSC/JLCPCB API client implementationPartCache- SQLite cache for offline-first operation
§Example
use atoxide_parts::{PartQuery, ResistorQuery, ParameterConstraint, ComponentType};
// Create a query for a 10k resistor in 0402 package
let query = ResistorQuery::new()
.resistance_range(9500.0, 10500.0) // 10k +/- 5%
.package("0402")
.power(0.0625) // 1/16W minimum
.tolerance(1.0) // 1% or better
.build();
// Or build a query directly
let query = PartQuery::resistor()
.with_package("0402")
.with_resistance(ParameterConstraint::between(9500.0, 10500.0))
.with_min_stock(100)
.with_limit(10);§Database Implementations
- LCSC: The
LcscClientconnects to the LCSC/JLCPCB component database - Cached: The
CachedDatabasewraps any database with SQLite caching
Modules§
- prelude
- Prelude module for convenient imports.
Structs§
- Availability
- Stock and availability information.
- Basic
Part Selector - A simple part selector that uses basic scoring.
- Cached
Database - A cached database that wraps another database and caches results.
- Capacitor
Query - Builder for creating capacitor queries with common parameters.
- Lcsc
Client - LCSC database client.
- Manufacturer
- Manufacturer information for a part.
- Package
- Physical package/footprint information.
- Part
- A component part from a part database.
- Part
Cache - SQLite-backed part cache.
- PartId
- A unique identifier for a part from a specific supplier.
- Part
Parameters - Electrical parameters for a part.
- Part
Query - A query for finding parts in a database.
- Part
Selection - A part selection result from the picker.
- Price
Tier - Price tier for quantity-based pricing.
- Resistor
Query - Builder for creating resistor queries with common parameters.
- Selection
Config - Configuration for part selection.
Enums§
- Component
Type - The type of component being searched for.
- Database
Error - Errors that can occur when querying a part database.
- Parameter
Constraint - A constraint on a parameter value.
- Parameter
Value - A parameter value that can be matched against constraints.
- Part
Class - Part classification for pricing purposes.
- Selection
Strategy - Strategy for selecting among multiple matching parts.
Traits§
- Part
Database - Trait for querying part databases.
- Part
Selector - Trait for part selection/picking logic.
Type Aliases§
- Database
Result - Result type for database operations.