From 3e84641e1fba59e84829c8334bd8cbc4d742aec7 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 24 Dec 2023 21:07:45 +0000 Subject: [PATCH] Start of the text module. --- src/lib.rs | 1 + src/text.rs | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/text.rs diff --git a/src/lib.rs b/src/lib.rs index 24a0489..fffce55 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,6 +3,7 @@ pub mod auth; pub mod html; pub mod scan_re; pub mod coloured_string; +pub mod text; #[derive(Debug)] pub enum OurError { diff --git a/src/text.rs b/src/text.rs new file mode 100644 index 0000000..a5c62bd --- /dev/null +++ b/src/text.rs @@ -0,0 +1,21 @@ +use super::coloured_string::ColouredString; + +pub trait TextFragment { + fn render(&self, width: usize) -> Vec; +} + +pub struct BlankLine {} + +impl BlankLine { + pub fn newbox() -> Box { + Box::new(BlankLine{}) + } +} + +impl TextFragment for BlankLine { + fn render(&self, _width: usize) -> Vec { + vec! { + ColouredString::plain(""), + } + } +} -- 2.30.2