Struct gray_matter::ParsedEntity [−][src]
pub struct ParsedEntity {
pub data: Option<Pod>,
pub content: String,
pub excerpt: Option<String>,
pub orig: String,
pub matter: String,
}
Expand description
ParsedEntity
stores a parsed result.
Examples
Basic usage:
let text = r#"---
field = "Value"
---
Here is excerpt
---
Here is content"#;
let matter = Matter::<TOML>::new();
let result: ParsedEntity = matter.parse(text);
assert_eq!(result.data.unwrap()["field"], Pod::String("Value".to_owned()));
assert_eq!(result.excerpt, Some("Here is excerpt".to_owned()));
assert_eq!(result.content, "Here is excerpt\n---\nHere is content")
Fields
data: Option<Pod>
Some(Pod)
if front matter was found. None
otherwise.
content: String
The full input, but with the front matter and delimiters stripped out. Any excerpt is also part of this field.
excerpt: Option<String>
A string containing the excerpt, if found. None
otherwise.
orig: String
The original input.
matter: String
The raw front matter. Empty string if no front matter is found.
Trait Implementations
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.