From 57e7a3513a7d247923288e05f9dd0cbc8ef288fd Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Sun, 27 Mar 2022 00:19:57 -0600 Subject: add README with high-level usage examples --- src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') 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> { + knuffel::parse("", schema_kdl) + } +} + #[derive(Debug, PartialEq, Eq, Default)] #[cfg_attr(feature = "parse-knuffel", derive(Decode))] pub struct Document { -- cgit v1.2.3