aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2020-10-13 18:44:01 +0200
committerAram Drevekenin <aram@poor.dev>2020-10-13 18:44:01 +0200
commit82e7f3db44a248658d062593b473a8db4b3f6d9c (patch)
treee4563b3a085a5ee9a7c2a137b4e348843d332da8 /src
parentfix(boundaries): render properly (diff)
downloadsl0ppij-82e7f3db44a248658d062593b473a8db4b3f6d9c.tar.gz
sl0ppij-82e7f3db44a248658d062593b473a8db4b3f6d9c.tar.xz
sl0ppij-82e7f3db44a248658d062593b473a8db4b3f6d9c.zip
refactor(boundaries): dynamic => static dispatch
Diffstat (limited to 'src')
-rw-r--r--src/boundaries.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/boundaries.rs b/src/boundaries.rs
index d4fedf5d..9399006e 100644
--- a/src/boundaries.rs
+++ b/src/boundaries.rs
@@ -160,7 +160,7 @@ impl Boundaries {
boundary_characters: HashMap::new(),
}
}
- pub fn add_rect(&mut self, rect: &dyn Rect) {
+ pub fn add_rect<R: Rect>(&mut self, rect: &R) {
if self.rect_right_boundary_is_before_screen_edge(rect) {
// let boundary_x_coords = self.rect_right_boundary_x_coords(rect);
let boundary_x_coords = rect.right_boundary_x_coords();
@@ -208,25 +208,25 @@ impl Boundaries {
}
vte_output
}
- fn rect_right_boundary_is_before_screen_edge (&self, rect: &dyn Rect) -> bool {
+ fn rect_right_boundary_is_before_screen_edge <R: Rect>(&self, rect: &R) -> bool {
rect.x() + rect.columns() < self.columns
}
- fn rect_bottom_boundary_is_before_screen_edge(&self, rect: &dyn Rect) -> bool {
+ fn rect_bottom_boundary_is_before_screen_edge<R: Rect>(&self, rect: &R) -> bool {
rect.y() + rect.rows() < self.rows
}
- fn rect_right_boundary_row_start(&self, rect: &dyn Rect) -> usize {
+ fn rect_right_boundary_row_start<R: Rect>(&self, rect: &R) -> usize {
if rect.y() == 0 { 0 } else { rect.y() - 1 }
}
- fn rect_right_boundary_row_end(&self, rect: &dyn Rect) -> usize {
+ fn rect_right_boundary_row_end<R: Rect>(&self, rect: &R) -> usize {
let rect_bottom_row = rect.y() + rect.rows();
// we do this because unless we're on the screen edge, we'd like to go one extra row to
// connect to whatever boundary is beneath us
if rect_bottom_row == self.rows { rect_bottom_row } else { rect_bottom_row + 1 }
}
- fn rect_bottom_boundary_col_start(&self, rect: &dyn Rect) -> usize {
+ fn rect_bottom_boundary_col_start<R: Rect>(&self, rect: &R) -> usize {
if rect.x() == 0 { 0 } else { rect.x() - 1 }
}
- fn rect_bottom_boundary_col_end(&self, rect: &dyn Rect) -> usize {
+ fn rect_bottom_boundary_col_end<R: Rect>(&self, rect: &R) -> usize {
let rect_right_col = rect.x() + rect.columns();
// we do this because unless we're on the screen edge, we'd like to go one extra column to
// connect to whatever boundary is right of us