From 686de0831c05a9ea646a0340c438819f880b281a Mon Sep 17 00:00:00 2001 From: Alexandre Bury Date: Sun, 9 Oct 2016 16:03:49 -0700 Subject: [PATCH] Take `&self` in TermionBackend::clear() --- src/backend/termion.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/backend/termion.rs b/src/backend/termion.rs index 82dc8f9..d3b25b4 100644 --- a/src/backend/termion.rs +++ b/src/backend/termion.rs @@ -1,5 +1,3 @@ - - use ::backend; use ::event::{Event, Key}; use std::io::Write; @@ -15,18 +13,19 @@ pub struct TermionBackend { impl backend::Backend for TermionBackend { fn init() -> Self { print!("{}", termion::cursor::Hide); - Self::clear(); - - TermionBackend { + let backend = TermionBackend { terminal: ::std::io::stdout().into_raw_mode().unwrap(), - } + }; + + backend.clear(); + backend } fn finish(&mut self) { // Maybe we should clear everything? print!("{}{}", termion::cursor::Show, termion::cursor::Goto(1, 1)); - Self::clear(); + self.clear(); } fn init_color_style(&mut self, style: ColorStyle, foreground: &Color, @@ -58,7 +57,7 @@ impl backend::Backend for TermionBackend { (x as usize, y as usize) } - fn clear() { + fn clear(&self) { print!("{}", termion::clear::All); }