aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-05-18 02:21:29 +0000
committerFuwn <[email protected]>2022-05-18 02:21:29 +0000
commit0842b253f61d19c18a9f2d5d70ba69543df639f9 (patch)
tree7133c33b5f08dbb913875a333a66a278352fd67e /src
parentci(tests): add convert tests (diff)
downloadgerm-0842b253f61d19c18a9f2d5d70ba69543df639f9.tar.xz
germ-0842b253f61d19c18a9f2d5d70ba69543df639f9.zip
feat(meta): add getters
Diffstat (limited to 'src')
-rw-r--r--src/convert/markdown.rs7
-rw-r--r--src/meta.rs12
2 files changed, 14 insertions, 5 deletions
diff --git a/src/convert/markdown.rs b/src/convert/markdown.rs
index 9bc0e6c..b400002 100644
--- a/src/convert/markdown.rs
+++ b/src/convert/markdown.rs
@@ -50,13 +50,14 @@ pub fn convert(source: Vec<Node>) -> String {
));
}
Node::List(items) =>
- markdown.push_str(&format!("{}\n",
+ markdown.push_str(&format!(
+ "{}\n",
items
.into_iter()
.map(|i| format!("- {}", i))
.collect::<Vec<String>>()
- .join("\n"),),
- ),
+ .join("\n"),
+ )),
Node::Blockquote(text) => markdown.push_str(&format!("> {}\n", text)),
Node::PreformattedText {
alt_text,
diff --git a/src/meta.rs b/src/meta.rs
index 45c90f1..9ff2712 100644
--- a/src/meta.rs
+++ b/src/meta.rs
@@ -23,9 +23,9 @@ use std::collections::HashMap;
#[derive(Debug)]
pub struct Meta {
/// The mime type of a Gemini response
- pub mime: String,
+ mime: String,
/// The parameters of a Gemini response
- pub parameters: HashMap<String, String>,
+ parameters: HashMap<String, String>,
}
impl Meta {
#[must_use]
@@ -50,4 +50,12 @@ impl Meta {
parameters,
}
}
+
+ #[must_use]
+ pub fn mime(&self) -> &str { &self.mime }
+
+ #[must_use]
+ pub const fn parameters(&self) -> &HashMap<String, String> {
+ &self.parameters
+ }
}