about summary refs log tree commit diff
path: root/src/display/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/display/mod.rs')
-rw-r--r--src/display/mod.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/display/mod.rs b/src/display/mod.rs
index 3e30200ac723..10690284f126 100644
--- a/src/display/mod.rs
+++ b/src/display/mod.rs
@@ -2,6 +2,8 @@ pub mod color;
 pub mod draw_box;
 pub mod utils;
 pub mod viewport;
+use crate::entities::entity::Entity;
+use crate::types::Neighbors;
 use crate::types::Positioned;
 pub use draw_box::{make_box, BoxStyle};
 use std::io::{self, Write};
@@ -29,3 +31,21 @@ impl<T: Draw> Draw for Box<T> {
         (**self).do_draw(out)
     }
 }
+
+pub trait DrawWithNeighbors: Positioned {
+    fn do_draw_with_neighbors<'a, 'b>(
+        &'a self,
+        out: &'b mut Write,
+        neighbors: &'a Neighbors<Vec<&'a Box<dyn Entity>>>,
+    ) -> io::Result<()>;
+}
+
+impl<T: Draw> DrawWithNeighbors for T {
+    fn do_draw_with_neighbors<'a, 'b>(
+        &'a self,
+        out: &'b mut Write,
+        _neighbors: &'a Neighbors<Vec<&'a Box<dyn Entity>>>,
+    ) -> io::Result<()> {
+        self.do_draw(out)
+    }
+}