aboutsummaryrefslogtreecommitdiff
path: root/examples/meta.rs
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-03-25 00:59:25 +0000
committerFuwn <[email protected]>2024-03-25 00:59:25 +0000
commit40680a3648cc7d598d428d6fe1752a2be9bfd547 (patch)
treec4ea43de3543995c0b81e1a982c8671479012fd5 /examples/meta.rs
parentfeat(crate): bump version (diff)
downloadgerm-40680a3648cc7d598d428d6fe1752a2be9bfd547.tar.xz
germ-40680a3648cc7d598d428d6fe1752a2be9bfd547.zip
docs(examples): comment examples
Diffstat (limited to 'examples/meta.rs')
-rw-r--r--examples/meta.rs22
1 files changed, 18 insertions, 4 deletions
diff --git a/examples/meta.rs b/examples/meta.rs
index a9f4077..e9d4cec 100644
--- a/examples/meta.rs
+++ b/examples/meta.rs
@@ -16,9 +16,23 @@
// Copyright (C) 2022-2022 Fuwn <[email protected]>
// SPDX-License-Identifier: GPL-3.0-only
+//! This example demonstrates Germ's capabilities for parsing Gemini meta
+//! sections.
+
fn main() {
- println!(
- "{:?}",
- germ::meta::Meta::from_string("text/gemini; hi=2; hi2=string=2")
- )
+ // Parse Gemini meta section into a structured meta representation
+ let meta = germ::meta::Meta::from_string("text/gemini; hi=2; hi2=string=2");
+
+ // Debug view of the structured meta representation
+ println!("{:?}", meta);
+
+ // Convert the structured meta representation back to a string, identical to
+ // the original meta section
+ println!("{}", meta.to_string());
+
+ // The MIME type of the meta section
+ println!("{}", meta.mime());
+
+ // A debug view of the parameters of the meta section
+ println!("{:?}", meta.parameters());
}