Skip to content

Commit 15c0deb

Browse files
committed
rename Dirs to Directions
1 parent 3efa839 commit 15c0deb

1 file changed

Lines changed: 27 additions & 27 deletions

File tree

asyncgit/src/graph/walker.rs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ bitflags! {
1717
/// are merged through this representation rather than
1818
/// a naive overwrite for readability.
1919
#[derive(Clone, Copy, Default)]
20-
struct Dirs: u8 {
20+
struct Directions: u8 {
2121
const UP = 0b0001;
2222
const DOWN = 0b0010;
2323
const LEFT = 0b0100;
2424
const RIGHT = 0b1000;
2525
}
2626
}
2727

28-
impl Dirs {
28+
impl Directions {
2929
#[allow(clippy::missing_const_for_fn)]
3030
fn merge(self, other: Self) -> Self {
3131
Self::from_bits_retain(self.bits() | other.bits())
@@ -39,23 +39,23 @@ impl Dirs {
3939

4040
/// The sub network of an existing connection glyph
4141
/// `None` represents commit markers, which are never drawn over.
42-
fn conn_dirs(conn: ConnectionType) -> Option<Dirs> {
42+
fn conn_dirs(conn: ConnectionType) -> Option<Directions> {
4343
Some(match conn {
4444
ConnectionType::Vertical | ConnectionType::VerticalDotted => {
45-
Dirs::UP | Dirs::DOWN
45+
Directions::UP | Directions::DOWN
4646
}
47-
ConnectionType::MergeBridgeMid => Dirs::LEFT | Dirs::RIGHT,
48-
ConnectionType::MergeBridgeStart => Dirs::DOWN | Dirs::LEFT,
49-
ConnectionType::MergeBridgeEnd => Dirs::DOWN | Dirs::RIGHT,
50-
ConnectionType::BranchUp => Dirs::UP | Dirs::LEFT,
51-
ConnectionType::BranchUpRight => Dirs::UP | Dirs::RIGHT,
52-
ConnectionType::TeeLeft => Dirs::UP | Dirs::DOWN | Dirs::LEFT,
47+
ConnectionType::MergeBridgeMid => Directions::LEFT | Directions::RIGHT,
48+
ConnectionType::MergeBridgeStart => Directions::DOWN | Directions::LEFT,
49+
ConnectionType::MergeBridgeEnd => Directions::DOWN | Directions::RIGHT,
50+
ConnectionType::BranchUp => Directions::UP | Directions::LEFT,
51+
ConnectionType::BranchUpRight => Directions::UP | Directions::RIGHT,
52+
ConnectionType::TeeLeft => Directions::UP | Directions::DOWN | Directions::LEFT,
5353
ConnectionType::TeeRight => {
54-
Dirs::UP | Dirs::DOWN | Dirs::RIGHT
54+
Directions::UP | Directions::DOWN | Directions::RIGHT
5555
}
56-
ConnectionType::TeeUp => Dirs::UP | Dirs::LEFT | Dirs::RIGHT,
56+
ConnectionType::TeeUp => Directions::UP | Directions::LEFT | Directions::RIGHT,
5757
ConnectionType::TeeDown => {
58-
Dirs::DOWN | Dirs::LEFT | Dirs::RIGHT
58+
Directions::DOWN | Directions::LEFT | Directions::RIGHT
5959
}
6060
ConnectionType::CommitNormal
6161
| ConnectionType::CommitBranch
@@ -69,11 +69,11 @@ fn conn_dirs(conn: ConnectionType) -> Option<Dirs> {
6969
/// Vertical lines take precedence in crossed cells.
7070
/// Yet the horizontal bridge continues in
7171
/// the spacer columns either side, so we retain wholeness.
72-
const fn dirs_conn(dirs: Dirs, dotted: bool) -> ConnectionType {
73-
let up = dirs.contains(Dirs::UP);
74-
let down = dirs.contains(Dirs::DOWN);
75-
let left = dirs.contains(Dirs::LEFT);
76-
let right = dirs.contains(Dirs::RIGHT);
72+
const fn dirs_conn(dirs: Directions, dotted: bool) -> ConnectionType {
73+
let up = dirs.contains(Directions::UP);
74+
let down = dirs.contains(Directions::DOWN);
75+
let left = dirs.contains(Directions::LEFT);
76+
let right = dirs.contains(Directions::RIGHT);
7777
match (up, down, left, right) {
7878
(true, true, true, false) => ConnectionType::TeeLeft,
7979
(true, true, false, true) => ConnectionType::TeeRight,
@@ -102,7 +102,7 @@ const fn dirs_conn(dirs: Dirs, dotted: bool) -> ConnectionType {
102102
/// ensuring lanes stay visually continuous
103103
fn overlay_cell(
104104
cell: &mut Option<(ConnectionType, LaneIndex)>,
105-
add: Dirs,
105+
add: Directions,
106106
color: LaneIndex,
107107
) {
108108
if let Some((conn, existing_color)) = cell {
@@ -258,15 +258,15 @@ impl GraphWalker {
258258
// target lane with the precise corner/junction
259259
lanes[target_lane] = None;
260260
let target_dirs = {
261-
let mut d = Dirs::DOWN;
261+
let mut d = Directions::DOWN;
262262
if continues_up {
263-
d |= Dirs::UP;
263+
d |= Directions::UP;
264264
}
265265
if target_lane > commit_lane {
266-
d |= Dirs::LEFT;
266+
d |= Directions::LEFT;
267267
}
268268
if target_lane < commit_lane {
269-
d |= Dirs::RIGHT;
269+
d |= Directions::RIGHT;
270270
}
271271
d
272272
};
@@ -306,12 +306,12 @@ impl GraphWalker {
306306
lane_color(branch_lane),
307307
);
308308
let branch_dirs = {
309-
let mut d = Dirs::UP;
309+
let mut d = Directions::UP;
310310
if branch_lane == to {
311-
d |= Dirs::LEFT;
311+
d |= Directions::LEFT;
312312
}
313313
if branch_lane == from {
314-
d |= Dirs::RIGHT;
314+
d |= Directions::RIGHT;
315315
}
316316
d
317317
};
@@ -477,7 +477,7 @@ impl GraphWalker {
477477
color: LaneIndex,
478478
) {
479479
for lane in lanes.iter_mut().take(to).skip(from + 1) {
480-
overlay_cell(lane, Dirs::LEFT | Dirs::RIGHT, color);
480+
overlay_cell(lane, Directions::LEFT | Directions::RIGHT, color);
481481
}
482482
}
483483
}

0 commit comments

Comments
 (0)