From 18bd24960b220a0467aee57b1f77952a694433f0 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Sun, 24 Apr 2022 00:33:26 -0600 Subject: use `r#ref` instead of `ref_` as field name --- src/lib.rs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index 5f915cf..65e3114 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -107,9 +107,7 @@ impl Schema { /// # Errors /// /// returns an error if knuffel can't parse the document as a Schema - pub fn parse( - schema_kdl: &str, - ) -> Result> { + pub fn parse(schema_kdl: &str) -> Result { knuffel::parse("", schema_kdl) } } @@ -240,7 +238,7 @@ pub struct Node { pub description: Option, /// KDL query from which to load node information instead of specifying it inline (allows for recursion) #[cfg_attr(feature = "parse-knuffel", knuffel(property))] - pub ref_: Option, + pub r#ref: Option, /// minimum number of occurrences of this node #[cfg_attr(feature = "parse-knuffel", knuffel(child, unwrap(argument)))] pub min: Option, @@ -301,7 +299,7 @@ impl Node { impl BuildFromRef for Node { fn ref_to(query: impl Into) -> Self { Self { - ref_: Some(query.into()), + r#ref: Some(query.into()), ..Self::default() } } @@ -322,7 +320,7 @@ pub struct Prop { pub description: Option, /// KDL query from which to load property information instead of specifying it inline (allows for recursion) #[cfg_attr(feature = "parse-knuffel", knuffel(property))] - pub ref_: Option, + pub r#ref: Option, /// whether or not this property is required #[cfg_attr(feature = "parse-knuffel", knuffel(child))] pub required: bool, @@ -344,7 +342,7 @@ impl Prop { impl BuildFromRef for Prop { fn ref_to(query: impl Into) -> Self { Self { - ref_: Some(query.into()), + r#ref: Some(query.into()), ..Self::default() } } @@ -362,7 +360,7 @@ pub struct Value { pub description: Option, /// KDL query from which to load value information instead of specifying it inline (allows for recursion) #[cfg_attr(feature = "parse-knuffel", knuffel(property))] - pub ref_: Option, + pub r#ref: Option, /// minimum number of occurrences of this value #[cfg_attr(feature = "parse-knuffel", knuffel(child, unwrap(argument)))] pub min: Option, @@ -387,7 +385,7 @@ impl Value { impl BuildFromRef for Value { fn ref_to(query: impl Into) -> Self { Self { - ref_: Some(query.into()), + r#ref: Some(query.into()), ..Self::default() } } @@ -405,7 +403,7 @@ pub struct Children { pub description: Option, /// KDL query from which to load children information instead of specifying it inline (allows for recursion) #[cfg_attr(feature = "parse-knuffel", knuffel(property))] - pub ref_: Option, + pub r#ref: Option, /// nodes which can appear as children #[cfg_attr(feature = "parse-knuffel", knuffel(children(name = "node")))] pub nodes: Vec, @@ -438,7 +436,7 @@ impl Children { impl BuildFromRef for Children { fn ref_to(query: impl Into) -> Self { Self { - ref_: Some(query.into()), + r#ref: Some(query.into()), ..Self::default() } } -- cgit v1.2.3