diff --git a/src/layout/layout.rs b/src/layout/layout.rs index 740b74a..38aa264 100644 --- a/src/layout/layout.rs +++ b/src/layout/layout.rs @@ -27,16 +27,21 @@ use crate::{ }, }; +/// Represents a weight for various compounds #[derive(Debug, Clone, Copy)] #[enum_dispatch(GetMaybeNet)] pub enum CompoundWeight { + /// Represents the weight of a polygon compound, includes its basic [`Layout`] information Poly(PolyWeight), + /// Represents Via weight properties, containing its [`Layout`] properties Via(ViaWeight), } +/// The alias to differ node types pub type NodeIndex = GenericNode>; #[derive(Debug, Getters)] +/// Structure for managing the Layout design pub struct Layout { drawing: Drawing, } @@ -46,9 +51,10 @@ impl Layout { Self { drawing } } + /// Insert [`Cane`] object into the [`Layout`] pub fn insert_cane( &mut self, - from: DotIndex, + from: DotIndex, around: GearIndex, dot_weight: LooseDotWeight, seg_weight: SeqLooseSegWeight, @@ -58,13 +64,15 @@ impl Layout { self.drawing .insert_cane(from, around, dot_weight, seg_weight, bend_weight, cw) } - + + /// Remove [`Cane`] object from the [`Layout`] pub fn remove_cane(&mut self, cane: &Cane, face: LooseDotIndex) { self.drawing.remove_cane(cane, face) } #[debug_ensures(ret.is_ok() -> self.drawing.node_count() == old(self.drawing.node_count()) + weight.to_layer - weight.from_layer + 2)] #[debug_ensures(ret.is_err() -> self.drawing.node_count() == old(self.drawing.node_count()))] + /// Insert [`Via`] into the [`Layout`] pub fn add_via(&mut self, weight: ViaWeight) -> Result, Infringement> { let compound = self.drawing.add_compound(weight.into()); let mut dots = vec![]; @@ -96,6 +104,7 @@ impl Layout { Ok(GenericIndex::::new(compound.petgraph_index())) } + pub fn add_fixed_dot(&mut self, weight: FixedDotWeight) -> Result { self.drawing.add_fixed_dot(weight) } diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 21eca73..e92c2d1 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -1,3 +1,5 @@ +//! Layout module for handling board geometry. + mod layout; pub mod poly; pub mod via; diff --git a/src/layout/poly.rs b/src/layout/poly.rs index 8e5ddb7..5d0b410 100644 --- a/src/layout/poly.rs +++ b/src/layout/poly.rs @@ -1,3 +1,5 @@ +//! Module for handling Polygon properties + use enum_dispatch::enum_dispatch; use geo::{LineString, Point, Polygon}; diff --git a/src/layout/via.rs b/src/layout/via.rs index f6338dd..2ab7437 100644 --- a/src/layout/via.rs +++ b/src/layout/via.rs @@ -1,3 +1,5 @@ +//! Module for handling Vias properties + use serde::{Deserialize, Serialize}; use crate::{