Struct gray_matter::ParsedEntityStruct
source · pub struct ParsedEntityStruct<T: DeserializeOwned> { /* private fields */ }
Expand description
ParsedEntityStruct
stores the parsed result with the front matter deserialized into a struct T
.
Examples
Basic usage:
#[derive(serde::Deserialize)]
struct FrontMatter {
field: i32,
}
let text = r#"---
field: -134
---
Here is excerpt
---
Here is content"#;
let matter = Matter::<YAML>::new();
let result: ParsedEntityStruct<FrontMatter> = matter.parse_with_struct(text).unwrap();
assert_eq!(result.data.field, -134);
assert_eq!(result.excerpt, Some("Here is excerpt".to_owned()));
assert_eq!(result.content, "Here is excerpt\n---\nHere is content")
Trait Implementations§
source§impl<T: Debug + DeserializeOwned> Debug for ParsedEntityStruct<T>
impl<T: Debug + DeserializeOwned> Debug for ParsedEntityStruct<T>
source§impl<T: PartialEq + DeserializeOwned> PartialEq<ParsedEntityStruct<T>> for ParsedEntityStruct<T>
impl<T: PartialEq + DeserializeOwned> PartialEq<ParsedEntityStruct<T>> for ParsedEntityStruct<T>
source§fn eq(&self, other: &ParsedEntityStruct<T>) -> bool
fn eq(&self, other: &ParsedEntityStruct<T>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.