use crate::core::*; pub trait BorderStyle { const NW: &'static str = ""; const N: &'static str = ""; const NE: &'static str = ""; const E: &'static str = ""; const SE: &'static str = ""; const S: &'static str = ""; const SW: &'static str = ""; const W: &'static str = ""; fn draw (&self, buf: &mut Buffer, area: Rect) { self.draw_horizontal(buf, area); self.draw_vertical(buf, area); self.draw_corners(buf, area); } fn draw_horizontal (&self, buf: &mut Buffer, area: Rect) { let style = self.style(); for x in area.x..(area.x+area.width).saturating_sub(1) { Self::N.blit(buf, x, area.y, style); Self::S.blit(buf, x, area.y + area.height - 1, style); } } fn draw_vertical (&self, buf: &mut Buffer, area: Rect) { let style = self.style(); for y in area.y..(area.y+area.height).saturating_sub(1) { Self::W.blit(buf, area.x, y, style); Self::E.blit(buf, area.x + area.width - 1, y, style); } } fn draw_corners (&self, buf: &mut Buffer, area: Rect) { let style = self.style(); Self::NW.blit(buf, area.x, area.y, style); Self::NE.blit(buf, area.x + area.width - 1, area.y, style); Self::SW.blit(buf, area.x, area.y + area.height - 1, style); Self::SE.blit(buf, area.x + area.width - 1, area.y + area.height - 1, style); } fn style (&self) -> Option