summaryrefslogtreecommitdiffstats
path: root/src/formatter/model.rs
diff options
context:
space:
mode:
authorZhenhui Xie <xiezh0831@yahoo.co.jp>2020-04-07 01:16:18 +0800
committerGitHub <noreply@github.com>2020-04-06 13:16:18 -0400
commit22dc419a3e0bee5d9a7ea72900b8503e9bd014fc (patch)
treeb3102feac3af53c2e0f4e818583ae6e8bf379cbb /src/formatter/model.rs
parent3510bfe0444c2bf4e8cf3e42fdf13fde8c05568f (diff)
improvement: add parser for format strings (#1021)
This PR implements the parser of format strings described in #624.
Diffstat (limited to 'src/formatter/model.rs')
-rw-r--r--src/formatter/model.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/formatter/model.rs b/src/formatter/model.rs
new file mode 100644
index 000000000..8e4bbea39
--- /dev/null
+++ b/src/formatter/model.rs
@@ -0,0 +1,17 @@
+use std::borrow::Cow;
+
+pub struct TextGroup<'a> {
+ pub format: Vec<FormatElement<'a>>,
+ pub style: Vec<StyleElement<'a>>,
+}
+
+pub enum FormatElement<'a> {
+ Text(Cow<'a, str>),
+ Variable(Cow<'a, str>),
+ TextGroup(TextGroup<'a>),
+}
+
+pub enum StyleElement<'a> {
+ Text(Cow<'a, str>),
+ Variable(Cow<'a, str>),
+}