Struct gray_matter::ParsedEntity
source · [−]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
sourceimpl Debug for ParsedEntity
impl Debug for ParsedEntity
sourceimpl PartialEq<ParsedEntity> for ParsedEntity
impl PartialEq<ParsedEntity> for ParsedEntity
sourcefn eq(&self, other: &ParsedEntity) -> bool
fn eq(&self, other: &ParsedEntity) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &ParsedEntity) -> bool
fn ne(&self, other: &ParsedEntity) -> bool
This method tests for !=
.
impl StructuralPartialEq for ParsedEntity
Auto Trait Implementations
impl RefUnwindSafe for ParsedEntity
impl Send for ParsedEntity
impl Sync for ParsedEntity
impl Unpin for ParsedEntity
impl UnwindSafe for ParsedEntity
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more