chiark / gitweb /
Start of the text module.
authorSimon Tatham <anakin@pobox.com>
Sun, 24 Dec 2023 21:07:45 +0000 (21:07 +0000)
committerSimon Tatham <anakin@pobox.com>
Sun, 24 Dec 2023 21:07:45 +0000 (21:07 +0000)
src/lib.rs
src/text.rs [new file with mode: 0644]

index 24a0489f5cb8318b5c3725eff75c7fb15f6e0dcb..fffce55b05e915d4e468cf47eecdd488c1a57fac 100644 (file)
@@ -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 (file)
index 0000000..a5c62bd
--- /dev/null
@@ -0,0 +1,21 @@
+use super::coloured_string::ColouredString;
+
+pub trait TextFragment {
+    fn render(&self, width: usize) -> Vec<ColouredString>;
+}
+
+pub struct BlankLine {}
+
+impl BlankLine {
+    pub fn newbox() -> Box<dyn TextFragment> {
+        Box::new(BlankLine{})
+    }
+}
+
+impl TextFragment for BlankLine {
+    fn render(&self, _width: usize) -> Vec<ColouredString> {
+        vec! {
+            ColouredString::plain(""),
+        }
+    }
+}