mirror of https://codeberg.org/topola/topola.git
cleanup: remove unused imports and traits
This commit is contained in:
parent
59180cc600
commit
4bb513ee08
23
src/graph.rs
23
src/graph.rs
|
|
@ -8,11 +8,6 @@ use petgraph::stable_graph::NodeIndex;
|
||||||
|
|
||||||
// Due to apparent limitations of enum_dispatch we're forced to import some types backwards.
|
// Due to apparent limitations of enum_dispatch we're forced to import some types backwards.
|
||||||
|
|
||||||
#[enum_dispatch]
|
|
||||||
pub trait NewFromNodeIndex {
|
|
||||||
fn new(index: NodeIndex<usize>) -> Self;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[enum_dispatch]
|
#[enum_dispatch]
|
||||||
pub trait GetNodeIndex {
|
pub trait GetNodeIndex {
|
||||||
fn node_index(&self) -> NodeIndex<usize>;
|
fn node_index(&self) -> NodeIndex<usize>;
|
||||||
|
|
@ -24,6 +19,15 @@ pub struct GenericIndex<W> {
|
||||||
marker: PhantomData<W>,
|
marker: PhantomData<W>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<W> GenericIndex<W> {
|
||||||
|
pub fn new(index: NodeIndex<usize>) -> Self {
|
||||||
|
Self {
|
||||||
|
node_index: index,
|
||||||
|
marker: PhantomData,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<W> Hash for GenericIndex<W> {
|
impl<W> Hash for GenericIndex<W> {
|
||||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||||
self.node_index.hash(state)
|
self.node_index.hash(state)
|
||||||
|
|
@ -38,15 +42,6 @@ impl<W> PartialEq for GenericIndex<W> {
|
||||||
|
|
||||||
impl<W> Eq for GenericIndex<W> {}
|
impl<W> Eq for GenericIndex<W> {}
|
||||||
|
|
||||||
impl<W> NewFromNodeIndex for GenericIndex<W> {
|
|
||||||
fn new(index: NodeIndex<usize>) -> Self {
|
|
||||||
Self {
|
|
||||||
node_index: index,
|
|
||||||
marker: PhantomData,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<W> GetNodeIndex for GenericIndex<W> {
|
impl<W> GetNodeIndex for GenericIndex<W> {
|
||||||
fn node_index(&self) -> NodeIndex<usize> {
|
fn node_index(&self) -> NodeIndex<usize> {
|
||||||
self.node_index
|
self.node_index
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ use crate::connectivity::{
|
||||||
BandIndex, BandWeight, ComponentIndex, ComponentWeight, ConnectivityGraph, ConnectivityLabel,
|
BandIndex, BandWeight, ComponentIndex, ComponentWeight, ConnectivityGraph, ConnectivityLabel,
|
||||||
ConnectivityWeight, GetNet,
|
ConnectivityWeight, GetNet,
|
||||||
};
|
};
|
||||||
use crate::graph::{GenericIndex, GetNodeIndex, NewFromNodeIndex};
|
use crate::graph::{GenericIndex, GetNodeIndex};
|
||||||
use crate::guide::Guide;
|
use crate::guide::Guide;
|
||||||
use crate::layout::bend::BendIndex;
|
use crate::layout::bend::BendIndex;
|
||||||
use crate::layout::dot::DotWeight;
|
use crate::layout::dot::DotWeight;
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,15 @@ use enum_dispatch::enum_dispatch;
|
||||||
use crate::{
|
use crate::{
|
||||||
connectivity::{BandIndex, ComponentIndex},
|
connectivity::{BandIndex, ComponentIndex},
|
||||||
graph::GenericIndex,
|
graph::GenericIndex,
|
||||||
layout::{GetNodeIndex, Layout, NewFromNodeIndex},
|
layout::{GetNodeIndex, Layout},
|
||||||
primitive::{GenericPrimitive, Primitive},
|
primitive::{GenericPrimitive, Primitive},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::geometry::{
|
use super::geometry::{
|
||||||
BendWeightTrait, GeometryIndex, GeometryWeight, GetBandIndex, GetComponentIndex,
|
BendWeightTrait, GeometryIndex, GeometryWeight, GetBandIndex, GetComponentIndex,
|
||||||
GetComponentIndexMut, GetOffset, GetPos, GetWidth, MakePrimitive, Retag,
|
GetComponentIndexMut, GetOffset, GetWidth, MakePrimitive, Retag,
|
||||||
};
|
};
|
||||||
use geo::Point;
|
|
||||||
use petgraph::stable_graph::NodeIndex;
|
use petgraph::stable_graph::NodeIndex;
|
||||||
|
|
||||||
#[enum_dispatch(GetNodeIndex, MakePrimitive)]
|
#[enum_dispatch(GetNodeIndex, MakePrimitive)]
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use geo::Point;
|
||||||
use crate::{
|
use crate::{
|
||||||
connectivity::{BandIndex, ComponentIndex},
|
connectivity::{BandIndex, ComponentIndex},
|
||||||
graph::GenericIndex,
|
graph::GenericIndex,
|
||||||
layout::{GetNodeIndex, Layout, NewFromNodeIndex},
|
layout::{GetNodeIndex, Layout},
|
||||||
math::Circle,
|
math::Circle,
|
||||||
primitive::{GenericPrimitive, Primitive},
|
primitive::{GenericPrimitive, Primitive},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
use contracts::debug_invariant;
|
|
||||||
use enum_dispatch::enum_dispatch;
|
use enum_dispatch::enum_dispatch;
|
||||||
use geo::Point;
|
use geo::Point;
|
||||||
use petgraph::{
|
use petgraph::{
|
||||||
|
|
@ -10,7 +9,7 @@ use petgraph::{
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
connectivity::{BandIndex, ComponentIndex},
|
connectivity::{BandIndex, ComponentIndex},
|
||||||
graph::{GenericIndex, GetNodeIndex, NewFromNodeIndex},
|
graph::{GenericIndex, GetNodeIndex},
|
||||||
layout::Layout,
|
layout::Layout,
|
||||||
math::Circle,
|
math::Circle,
|
||||||
primitive::Primitive,
|
primitive::Primitive,
|
||||||
|
|
@ -19,7 +18,7 @@ use crate::{
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
bend::{FixedBendIndex, FixedBendWeight, LooseBendIndex, LooseBendWeight},
|
bend::{FixedBendIndex, FixedBendWeight, LooseBendIndex, LooseBendWeight},
|
||||||
dot::{DotWeight, FixedDotIndex, FixedDotWeight, LooseDotIndex, LooseDotWeight},
|
dot::{FixedDotIndex, FixedDotWeight, LooseDotIndex, LooseDotWeight},
|
||||||
seg::{
|
seg::{
|
||||||
FixedSegIndex, FixedSegWeight, LoneLooseSegIndex, LoneLooseSegWeight, SeqLooseSegIndex,
|
FixedSegIndex, FixedSegWeight, LoneLooseSegIndex, LoneLooseSegWeight, SeqLooseSegIndex,
|
||||||
SeqLooseSegWeight,
|
SeqLooseSegWeight,
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ use enum_dispatch::enum_dispatch;
|
||||||
use crate::{
|
use crate::{
|
||||||
connectivity::{BandIndex, ComponentIndex},
|
connectivity::{BandIndex, ComponentIndex},
|
||||||
graph::GenericIndex,
|
graph::GenericIndex,
|
||||||
layout::{GetNodeIndex, Layout, NewFromNodeIndex},
|
layout::{GetNodeIndex, Layout},
|
||||||
primitive::{GenericPrimitive, Primitive},
|
primitive::{GenericPrimitive, Primitive},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,9 @@
|
||||||
use std::mem::swap;
|
|
||||||
|
|
||||||
use enum_dispatch::enum_dispatch;
|
use enum_dispatch::enum_dispatch;
|
||||||
use petgraph::stable_graph::NodeIndex;
|
use petgraph::stable_graph::NodeIndex;
|
||||||
use petgraph::Direction::{Incoming, Outgoing};
|
use petgraph::Direction::{Incoming, Outgoing};
|
||||||
|
|
||||||
use crate::connectivity::{BandIndex, ComponentIndex, GetNet};
|
use crate::connectivity::{BandIndex, ComponentIndex, GetNet};
|
||||||
use crate::graph::{GenericIndex, GetNodeIndex, NewFromNodeIndex};
|
use crate::graph::{GenericIndex, GetNodeIndex};
|
||||||
use crate::layout::seg::{
|
use crate::layout::seg::{
|
||||||
FixedSegIndex, FixedSegWeight, LoneLooseSegIndex, LoneLooseSegWeight, SegIndex,
|
FixedSegIndex, FixedSegWeight, LoneLooseSegIndex, LoneLooseSegWeight, SegIndex,
|
||||||
SeqLooseSegIndex, SeqLooseSegWeight,
|
SeqLooseSegIndex, SeqLooseSegWeight,
|
||||||
|
|
@ -20,8 +18,8 @@ use crate::layout::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use crate::loose::{Loose, LooseIndex};
|
use crate::loose::{Loose, LooseIndex};
|
||||||
use crate::math::{self, Circle};
|
|
||||||
use crate::shape::{BendShape, DotShape, SegShape, Shape, ShapeTrait};
|
use crate::shape::{Shape, ShapeTrait};
|
||||||
|
|
||||||
#[enum_dispatch]
|
#[enum_dispatch]
|
||||||
pub trait GetLayout {
|
pub trait GetLayout {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue