aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2022-03-27 00:19:57 -0600
committerMelody Horn <melody@boringcactus.com>2022-03-27 00:19:57 -0600
commit57e7a3513a7d247923288e05f9dd0cbc8ef288fd (patch)
tree59ceb7f74d61560f1b600158eed9fc450c7a4602 /src
parent8130a49f045764a200082e5c296eae7a9d4b4e37 (diff)
downloadkdl-schema-57e7a3513a7d247923288e05f9dd0cbc8ef288fd.tar.gz
kdl-schema-57e7a3513a7d247923288e05f9dd0cbc8ef288fd.zip
add README with high-level usage examples
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 97dbce4..c724687 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,3 +1,4 @@
+#![doc = include_str!("../README.md")]
#![warn(clippy::pedantic, clippy::cargo)]
#[cfg(feature = "parse-knuffel")]
@@ -17,6 +18,15 @@ pub struct Schema {
pub document: Document,
}
+#[cfg(feature = "parse-knuffel")]
+impl Schema {
+ pub fn parse(
+ schema_kdl: &str,
+ ) -> Result<Self, knuffel::Error<impl knuffel::traits::ErrorSpan>> {
+ knuffel::parse("<Schema::parse argument>", schema_kdl)
+ }
+}
+
#[derive(Debug, PartialEq, Eq, Default)]
#[cfg_attr(feature = "parse-knuffel", derive(Decode))]
pub struct Document {