diff --git a/topola/src/board/selections/mod.rs b/topola/src/board/selections/mod.rs index b249160..f2c0dc3 100644 --- a/topola/src/board/selections/mod.rs +++ b/topola/src/board/selections/mod.rs @@ -3,10 +3,11 @@ // SPDX-License-Identifier: MIT OR Apache-2.0 mod component; +mod net; mod persistable; mod pin; -mod route; pub use component::{ComponentSelection, ComponentSelector}; +pub use net::{NetSelection, NetSelector}; pub use persistable::PersistableSelection; pub use pin::{PinSelection, PinSelector}; diff --git a/topola/src/board/selections/route.rs b/topola/src/board/selections/net.rs similarity index 54% rename from topola/src/board/selections/route.rs rename to topola/src/board/selections/net.rs index b75dfa4..5e7912c 100644 --- a/topola/src/board/selections/route.rs +++ b/topola/src/board/selections/net.rs @@ -6,32 +6,26 @@ use std::collections::BTreeSet; use serde::{Deserialize, Serialize}; -use crate::selections::PinSelector; - #[derive(Clone, Debug, Default, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)] -pub struct RouteSelector { - lesser_pin: PinSelector, - greater_pin: PinSelector, +pub struct NetSelector { + pub net: String, } -impl RouteSelector { - pub fn new(pin1: PinSelector, pin2: PinSelector) -> Self { - Self { - lesser_pin: std::cmp::min(pin1.clone(), pin2.clone()), - greater_pin: std::cmp::max(pin1, pin2), - } +impl NetSelector { + pub fn new(net: String) -> Self { + Self { net } } } #[derive(Clone, Debug, Default, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)] -pub struct RouteSelection(pub BTreeSet); +pub struct NetSelection(pub BTreeSet); -impl RouteSelection { +impl NetSelection { pub fn new() -> Self { Default::default() } - pub fn toggle(&mut self, selector: RouteSelector) { + pub fn toggle(&mut self, selector: NetSelector) { if self.0.contains(&selector) { self.0.remove(&selector); } else { diff --git a/topola/src/board/selections/persistable.rs b/topola/src/board/selections/persistable.rs index a8da51e..ec7e9bb 100644 --- a/topola/src/board/selections/persistable.rs +++ b/topola/src/board/selections/persistable.rs @@ -4,15 +4,12 @@ use serde::{Deserialize, Serialize}; -use crate::{ - board::selections::{ComponentSelection, PinSelection}, - selections::route::RouteSelection, -}; +use crate::board::selections::{ComponentSelection, NetSelection, PinSelection}; #[derive(Clone, Debug, Default, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)] pub struct PersistableSelection { pub components: ComponentSelection, - pub routes: RouteSelection, + pub nets: NetSelection, pub pins: PinSelection, } @@ -20,7 +17,7 @@ impl PersistableSelection { pub fn new() -> Self { Self { components: ComponentSelection::new(), - routes: RouteSelection::new(), + nets: NetSelection::new(), pins: PinSelection::new(), } }