From 76ab78d565a3480ba82238da3aae629df7633f14 Mon Sep 17 00:00:00 2001 From: Weird Constructor Date: Sun, 25 Jul 2021 15:53:51 +0200 Subject: [PATCH] Added function for flipping CellDir directions --- src/cell_dir.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/cell_dir.rs b/src/cell_dir.rs index 9e08bc9..cecbc4b 100644 --- a/src/cell_dir.rs +++ b/src/cell_dir.rs @@ -27,6 +27,18 @@ impl CellDir { } } + pub fn flip(&self) -> Self { + match self { + CellDir::TR => CellDir::BL, + CellDir::BR => CellDir::TL, + CellDir::B => CellDir::T, + CellDir::BL => CellDir::TR, + CellDir::TL => CellDir::BR, + CellDir::T => CellDir::B, + CellDir::C => CellDir::T, + } + } + #[inline] pub fn is_output(&self) -> bool { let e = self.as_edge();