pub struct DesignRules {Show 14 fields
pub track_width: i32,
pub clearance: i32,
pub via_diameter: i32,
pub via_drill: i32,
pub edge_clearance: i32,
pub routing_grid: i32,
pub net_widths: BTreeMap<String, i32>,
pub mask_expansion: i32,
pub autoroute_vias: ViaPolicy,
pub net_classes: Vec<NetClass>,
pub net_class_of: BTreeMap<String, String>,
pub min_annular_ring: i32,
pub tent_vias: bool,
pub min_hole_spacing: i32,
}Fields§
§track_width: i32The Default net class’s track width, clearance and via (net_classes).
clearance: i32§via_diameter: i32§via_drill: i32§edge_clearance: i32Minimum distance from copper to the board outline.
routing_grid: i32Autorouter grid pitch.
net_widths: BTreeMap<String, i32>Track width overrides by exact net name, e.g. wider supply nets.
mask_expansion: i32Solder mask openings extend this far beyond each pad.
autoroute_vias: ViaPolicyHow the autorouter uses vias. Boards saved before this existed get the default.
net_classes: Vec<NetClass>The net classes besides Default, in pattern order (net_classes). Written
only when there are some, so a board with none saves as it did before.
net_class_of: BTreeMap<String, String>Explicit net → class assignments, which beat every pattern.
min_annular_ring: i32The narrowest plated copper ring a drilled pad or via may keep round its hole. Written only when it differs from the default, so a board that never changed it is stored as before.
tent_vias: boolWhether the solder mask covers every via (tented, the default) or opens over each via’s ring on both sides. Written only when off.
min_hole_spacing: i32The narrowest web of board left between two drilled holes, edge to edge (KiCad’s hole to hole). 0 turns the check off, though holes that touch are always a finding. Written only when it differs from the default.
Implementations§
Source§impl DesignRules
impl DesignRules
Sourcepub fn default_class(&self) -> NetClass
pub fn default_class(&self) -> NetClass
The Default class: this board’s own track width, clearance and via.
Sourcepub fn classes(&self) -> Vec<NetClass>
pub fn classes(&self) -> Vec<NetClass>
Every class, Default first, then the stored ones in list order.
Sourcepub fn class_reason(&self, net: Option<&str>) -> (NetClass, ClassReason)
pub fn class_reason(&self, net: Option<&str>) -> (NetClass, ClassReason)
The class net is in and why (module docs for the order).
Sourcepub fn class_of(&self, net: Option<&str>) -> NetClass
pub fn class_of(&self, net: Option<&str>) -> NetClass
The class net is in; None (copper on no net) is Default.
Sourcepub fn class_of_nets<'a>(
&self,
nets: impl IntoIterator<Item = &'a str>,
) -> NetClass
pub fn class_of_nets<'a>( &self, nets: impl IntoIterator<Item = &'a str>, ) -> NetClass
The class that sets the clearance for copper carrying nets (several for
an island that shorts two nets; none for netless copper): the one with the
largest clearance, Default for none.
Sourcepub fn clearance_between(
&self,
a: Option<&str>,
b: Option<&str>,
) -> (i32, NetClass)
pub fn clearance_between( &self, a: Option<&str>, b: Option<&str>, ) -> (i32, NetClass)
The clearance copper of a must keep from copper of b: the larger of
their classes’ clearances, with the class that set it (a’s on a tie).
Sourcepub fn clearance_between_nets<'a>(
&self,
a: impl IntoIterator<Item = &'a str>,
b: impl IntoIterator<Item = &'a str>,
) -> (i32, NetClass)
pub fn clearance_between_nets<'a>( &self, a: impl IntoIterator<Item = &'a str>, b: impl IntoIterator<Item = &'a str>, ) -> (i32, NetClass)
Self::clearance_between for two sets of nets (Self::class_of_nets).
Sourcepub fn clearance_between_classes(a: &NetClass, b: &NetClass) -> (i32, NetClass)
pub fn clearance_between_classes(a: &NetClass, b: &NetClass) -> (i32, NetClass)
Self::clearance_between for two classes already looked up, for a caller
that looks each net’s class up once and then pairs them many times (the
autorouter).
Sourcepub fn max_clearance(&self) -> i32
pub fn max_clearance(&self) -> i32
The largest clearance any class asks for.
Sourcepub fn min_clearance(&self) -> i32
pub fn min_clearance(&self) -> i32
The smallest clearance any class asks for.
Sourcepub fn width_for(&self, net: &str) -> i32
pub fn width_for(&self, net: &str) -> i32
The track width for net: its own width (Self::net_widths) if it has
one, else its class’s. Every width a new track is given comes from here.
Sourcepub fn via_for(&self, net: Option<&str>) -> (i32, i32)
pub fn via_for(&self, net: Option<&str>) -> (i32, i32)
The via diameter and drill for net (None: Default’s).
Sourcepub fn check_net_classes(&self) -> Result<(), String>
pub fn check_net_classes(&self) -> Result<(), String>
Why the class list or assignment can not be saved, if it can not.