pub struct Matter<T: Engine> {
pub delimiter: String,
pub close_delimiter: Option<String>,
pub excerpt_delimiter: Option<String>,
/* private fields */
}Expand description
Coupled with an Engine of choice, Matter stores delimiter(s) and
handles parsing.
Fields§
§delimiter: String§close_delimiter: Option<String>§excerpt_delimiter: Option<String>Implementations§
Source§impl<T: Engine> Matter<T>
impl<T: Engine> Matter<T>
pub fn new() -> Self
Sourcepub fn parse<D: DeserializeOwned>(&self, input: &str) -> Result<ParsedEntity<D>>
pub fn parse<D: DeserializeOwned>(&self, input: &str) -> Result<ParsedEntity<D>>
Runs parsing on the input. Uses the engine contained in self to parse any front matter
detected.
§Examples
Basic usage:
let matter: Matter<YAML> = Matter::new();
let input = "---\ntitle: Home\n---\nOther stuff";
let parsed_entity: ParsedEntity = matter.parse(input).unwrap();
assert_eq!(parsed_entity.content, "Other stuff");Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Matter<T>
impl<T> RefUnwindSafe for Matter<T>where
T: RefUnwindSafe,
impl<T> Send for Matter<T>where
T: Send,
impl<T> Sync for Matter<T>where
T: Sync,
impl<T> Unpin for Matter<T>where
T: Unpin,
impl<T> UnwindSafe for Matter<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more