diff options
author | Griffin Smith <root@gws.fyi> | 2019-08-25T17·25-0400 |
---|---|---|
committer | Griffin Smith <root@gws.fyi> | 2019-08-25T17·25-0400 |
commit | fb0d1b3e66251aa56a3df1d05fd4b82b33380a31 (patch) | |
tree | 367edbe5f504a3eb8130e5e0a8dd695fbbc65684 /src/display/mod.rs | |
parent | e2d2f011c6373894b3cdcfbdb98fbc783504561a (diff) |
Wipe Rust project
Sorry rust, but you're just not fun to write
Diffstat (limited to 'src/display/mod.rs')
-rw-r--r-- | src/display/mod.rs | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/src/display/mod.rs b/src/display/mod.rs deleted file mode 100644 index 6e37a03d8c55..000000000000 --- a/src/display/mod.rs +++ /dev/null @@ -1,52 +0,0 @@ -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}; -use termion::{clear, cursor, style}; -pub use viewport::Viewport; - -pub fn clear<T: Write>(out: &mut T) -> io::Result<()> { - write!(out, "{}{}{}", clear::All, style::Reset, cursor::Goto(1, 1)) -} - -pub trait Draw: Positioned { - /// Draw this entity, assuming the character is already at the correct - /// position - fn do_draw(&self, out: &mut dyn Write) -> io::Result<()>; -} - -impl<T: Draw> Draw for &T { - fn do_draw(&self, out: &mut dyn Write) -> io::Result<()> { - (**self).do_draw(out) - } -} - -impl<T: Draw> Draw for Box<T> { - fn do_draw(&self, out: &mut dyn Write) -> io::Result<()> { - (**self).do_draw(out) - } -} - -pub trait DrawWithNeighbors: Positioned { - #[allow(clippy::borrowed_box)] - fn do_draw_with_neighbors<'a, 'b>( - &'a self, - out: &'b mut dyn 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 dyn Write, - _neighbors: &'a Neighbors<Vec<&'a Box<dyn Entity>>>, - ) -> io::Result<()> { - self.do_draw(out) - } -} |