Skip to main content

DesignRules

Struct DesignRules 

Source
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: i32

The Default net class’s track width, clearance and via (net_classes).

§clearance: i32§via_diameter: i32§via_drill: i32§edge_clearance: i32

Minimum distance from copper to the board outline.

§routing_grid: i32

Autorouter grid pitch.

§net_widths: BTreeMap<String, i32>

Track width overrides by exact net name, e.g. wider supply nets.

§mask_expansion: i32

Solder mask openings extend this far beyond each pad.

§autoroute_vias: ViaPolicy

How 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: i32

The 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: bool

Whether 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: i32

The 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

Source

pub fn default_class(&self) -> NetClass

The Default class: this board’s own track width, clearance and via.

Source

pub fn classes(&self) -> Vec<NetClass>

Every class, Default first, then the stored ones in list order.

Source

pub fn class_reason(&self, net: Option<&str>) -> (NetClass, ClassReason)

The class net is in and why (module docs for the order).

Source

pub fn class_of(&self, net: Option<&str>) -> NetClass

The class net is in; None (copper on no net) is Default.

Source

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.

Source

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).

Source

pub fn clearance_between_nets<'a>( &self, a: impl IntoIterator<Item = &'a str>, b: impl IntoIterator<Item = &'a str>, ) -> (i32, NetClass)

Source

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).

Source

pub fn max_clearance(&self) -> i32

The largest clearance any class asks for.

Source

pub fn min_clearance(&self) -> i32

The smallest clearance any class asks for.

Source

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.

Source

pub fn via_for(&self, net: Option<&str>) -> (i32, i32)

The via diameter and drill for net (None: Default’s).

Source

pub fn check_net_classes(&self) -> Result<(), String>

Why the class list or assignment can not be saved, if it can not.

Trait Implementations§

Source§

impl Clone for DesignRules

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DesignRules

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DesignRules

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for DesignRules

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for DesignRules

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for DesignRules

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for DesignRules

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.