pub struct PcbComponent {
pub pattern: String,
pub description: String,
pub height: Coord,
pub item_guid: String,
pub revision_guid: String,
pub primitives: Vec<PcbRecord>,
}Expand description
A PCB component (footprint) containing primitives.
Fields§
§pattern: StringFootprint pattern name.
description: StringDescription.
height: CoordHeight.
item_guid: StringItem GUID.
revision_guid: StringRevision GUID.
primitives: Vec<PcbRecord>Primitives belonging to this component.
Implementations§
Source§impl PcbComponent
Extension methods for PcbComponent to support editing.
impl PcbComponent
Extension methods for PcbComponent to support editing.
Sourcepub fn new(pattern: impl Into<String>) -> Self
👎Deprecated since 0.1.0: Use new_deterministic() with a DeterminismContext for reproducible execution
pub fn new(pattern: impl Into<String>) -> Self
Create a new empty component (non-deterministic).
Prefer using new_deterministic() for reproducible execution.
Sourcepub fn new_deterministic(pattern: impl Into<String>, _det: &mut ()) -> Self
pub fn new_deterministic(pattern: impl Into<String>, _det: &mut ()) -> Self
Create new component with standard UUID generation.
Standalone library uses standard UUIDs; Cadatomic fork replaces with deterministic context.
Sourcepub fn set_description(&mut self, desc: impl Into<String>)
pub fn set_description(&mut self, desc: impl Into<String>)
Set the description.
Sourcepub fn add_primitive(&mut self, record: PcbRecord)
pub fn add_primitive(&mut self, record: PcbRecord)
Add a primitive.
Sourcepub fn remove_primitive(&mut self, index: usize) -> Option<PcbRecord>
pub fn remove_primitive(&mut self, index: usize) -> Option<PcbRecord>
Remove a primitive by index.
Sourcepub fn find_pad_mut(&mut self, designator: &str) -> Option<&mut PcbPad>
pub fn find_pad_mut(&mut self, designator: &str) -> Option<&mut PcbPad>
Find a pad by designator (mutable).
Source§impl PcbComponent
impl PcbComponent
Sourcepub fn import_from_parameters(&mut self, p: &ParameterCollection)
pub fn import_from_parameters(&mut self, p: &ParameterCollection)
Import component data from parameters.
Sourcepub fn export_to_parameters(&self) -> ParameterCollection
pub fn export_to_parameters(&self) -> ParameterCollection
Export component data to parameters.
Sourcepub fn primitive_count(&self) -> usize
pub fn primitive_count(&self) -> usize
Total primitive count.
Sourcepub fn calculate_bounds(&self) -> CoordRect
pub fn calculate_bounds(&self) -> CoordRect
Calculate the bounding rectangle of all primitives.
Trait Implementations§
Source§impl Clone for PcbComponent
impl Clone for PcbComponent
Source§fn clone(&self) -> PcbComponent
fn clone(&self) -> PcbComponent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PcbComponent
impl Debug for PcbComponent
Source§impl Default for PcbComponent
impl Default for PcbComponent
Source§fn default() -> PcbComponent
fn default() -> PcbComponent
Returns the “default value” for a type. Read more
Source§impl DumpTree for PcbComponent
impl DumpTree for PcbComponent
Source§fn dump(&self, tree: &mut TreeBuilder)
fn dump(&self, tree: &mut TreeBuilder)
Dump this item to the tree builder.
Source§fn dump_to_string(&self) -> String
fn dump_to_string(&self) -> String
Convenience method to dump to a string.
Source§fn dump_to_string_with_options(&self, options: DumpOptions) -> String
fn dump_to_string_with_options(&self, options: DumpOptions) -> String
Convenience method to dump to a string with options.
Auto Trait Implementations§
impl Freeze for PcbComponent
impl RefUnwindSafe for PcbComponent
impl Send for PcbComponent
impl Sync for PcbComponent
impl Unpin for PcbComponent
impl UnwindSafe for PcbComponent
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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