From 54f5e9fd883e207931baa9c87b6181ca724d6bab Mon Sep 17 00:00:00 2001 From: Ben Bridle <bridle.benjamin@gmail.com> Date: Thu, 25 Aug 2022 21:09:25 +1200 Subject: Initial commit --- src/text.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/text.rs (limited to 'src/text.rs') diff --git a/src/text.rs b/src/text.rs new file mode 100644 index 0000000..e9dbdeb --- /dev/null +++ b/src/text.rs @@ -0,0 +1,30 @@ +pub enum Text { + Normal(String), + Bold(String), + Italic(String), + BoldItalic(String), + Code(String), + WikiLink(String), + Hyperlink(Hyperlink), +} +impl std::fmt::Debug for Text { + fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> { + let string = match self { + Text::Normal(text) => format!("Normal ('{}')", text), + Text::Bold(text) => format!("Bold ('{}')", text), + Text::Italic(text) => format!("Italic ('{}')", text), + Text::BoldItalic(text) => format!("BoldItalic ('{}')", text), + Text::Code(text) => format!("Code ('{}')", text), + Text::WikiLink(text) => format!("WikiLink ('{}')", text), + Text::Hyperlink(Hyperlink { label, target }) => { + format!("Hyperlink (label:'{}', target:'{}')", label, target) + } + }; + f.write_str(&string) + } +} + +pub struct Hyperlink { + pub label: String, + pub target: String, +} -- cgit v1.2.3-70-g09d2