pub struct Catalog {
pub parts: Vec<Part>,
}Expand description
Parts, from one catalog file or several.
Fields§
§parts: Vec<Part>Every part, in file order.
Implementations§
Source§impl Catalog
impl Catalog
Sourcepub fn find(&self, manufacturer: &str, part_number: &str) -> Vec<&Part>
pub fn find(&self, manufacturer: &str, part_number: &str) -> Vec<&Part>
Every part whose maker is manufacturer and whose part number is part_number, in
catalog order. Both are compared with surrounding spaces trimmed, the maker in any case
and the part number exactly. The maker is the file’s name for it, not OpenRocket’s display
name (“LOC Precision”, not “LOC/Precision”). Most numbers name one part; in the bundled
catalog, 21 numbers name two parts of the same kind, and 3 of those pairs are identical.
Sourcepub fn search(&self, manufacturer: Option<&str>, text: &str) -> Vec<&Part>
pub fn search(&self, manufacturer: Option<&str>, text: &str) -> Vec<&Part>
Every part whose part number or description holds text, in any case, from the maker
manufacturer (in any case) or from any maker if None, in catalog order; empty
text matches every part. Part numbers are often several numbers in one, such as Estes’
BT-20, 30316, which find matches only whole; a search for 30316 finds it.
Sourcepub fn manufacturers(&self) -> Vec<&str>
pub fn manufacturers(&self) -> Vec<&str>
The makers, each once, in the order they first appear.