Skip to main content

blockworx/router/
channel.rs

1use crate::router::{cost::Cost, point::Point};
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
4pub enum ChannelOrientation {
5    Horizontal,
6    Vertical,
7}
8
9/// A routing line anchored at `seed`, extending in the `orientation` direction.
10#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
11pub struct Channel {
12    pub seed: Point,
13    pub cost: Cost,
14    pub orientation: ChannelOrientation,
15}
16
17pub fn h_channel(seed: impl Into<Point>, cost: impl Into<Cost>) -> Channel {
18    Channel {
19        seed: seed.into(),
20        cost: cost.into(),
21        orientation: ChannelOrientation::Horizontal,
22    }
23}
24
25pub fn v_channel(seed: impl Into<Point>, cost: impl Into<Cost>) -> Channel {
26    Channel {
27        seed: seed.into(),
28        cost: cost.into(),
29        orientation: ChannelOrientation::Vertical,
30    }
31}