pub fn parse_with_struct<D: serde::de::DeserializeOwned>(
        &self,
        input: &str,
    ) -> Option<ParsedEntityStruct<D>> {
        let parsed_entity = self.parse(input);
        let data: D = parsed_entity.data?.deserialize().ok()?;

        Some(ParsedEntityStruct {
            data,
            content: parsed_entity.content,
            excerpt: parsed_entity.excerpt,
            orig: parsed_entity.orig,
            matter: parsed_entity.matter,
        })
    }
/// Wrapper around [`parse`](Matter::parse), that deserializes any front matter into a custom
/// struct. Supplied as an ease-of-use function to prevent having to deserialize manually.
///
/// Returns `None` if no front matter is found, or if the front matter is not deserializable
/// into the custom struct.
///
/// ## Examples
///
/// Basic usage:
///
/// ```rust
/// # use gray_matter::Matter;
/// # use gray_matter::engine::YAML;
/// # use gray_matter::ParsedEntityStruct;
/// #[derive(serde::Deserialize)]
/// struct Config {
///     title: String,
/// }
///
/// let matter: Matter<YAML> = Matter::new();
/// let input = "---\ntitle: Home\n---\nOther stuff";
/// let parsed_entity =  matter.parse_with_struct::<Config>(input).unwrap();
///
/// assert_eq!(parsed_entity.data.title, "Home");
/// ```
Wrapper around [`parse`](Matter::parse), that deserializes any front matter into a custom
struct. Supplied as an ease-of-use function to prevent having to deserialize manually.

Returns `None` if no front matter is found, or if the front matter is not deserializable
into the custom struct.
Wrapper around [ ` parse ` ] ( Matter :: parse ) that deserializes any front matter into a custom struct . Supplied as an ease - of - use function to prevent having to deserialize manually . Returns ` None ` if no front matter is found or if the front matter is not deserializable into the custom struct .
pub fn parse_with_struct<D: serde::de::DeserializeOwned>(
        &self,
        input: &str,
    ) -> Option<ParsedEntityStruct<D>> {
        let parsed_entity = self.parse(input);
        let data: D = parsed_entity.data?.deserialize().ok()?;
        Some(ParsedEntityStruct {
            data,
            content: parsed_entity.content,
            excerpt: parsed_entity.excerpt,
            orig: parsed_entity.orig,
            matter: parsed_entity.matter,
        })
    }
pub fn parse_with_struct < D : serde :: de :: DeserializeOwned > ( & self , input : & str , ) -> Option < ParsedEntityStruct < D > > { let parsed_entity = self . parse ( input ) ; let data : D = parsed_entity . data ? . deserialize ( ) . ok ( ) ? ; Some ( ParsedEntityStruct { data , content : parsed_entity . content , excerpt : parsed_entity . excerpt , orig : parsed_entity . orig , matter : parsed_entity . matter , } ) }
Wrapper around [`parse`](Matter::parse), that deserializes any front matter into a custom
struct.
Wrapper around [ ` parse ` ] ( Matter :: parse ) that deserializes any front matter into a custom struct .
&self
input
&str
&self
input
&str
examples
None
use gray_matter::matter;
None
use gray_matter::engine::yaml;
None
use gray_matter::parsedentitystruct;
None
[derive(serde::deserialize)]
struct Config {
title: String,
}

let matter: Matter = Matter::new();
let input = "---\ntitle: Home\n---\nOther stuff";
let parsed_entity =  matter.parse_with_struct::(input).unwrap().

assert_eq!(parsed_entity.data.title, "Home");
```
struct Config { title : String } let matter : Matter = Matter :: new () ; let input = " --- \ ntitle : Home \ n --- \ nOther stuff " ; let parsed_entity = matter . parse_with_struct :: ( input ) . unwrap () . assert_eq! ( parsed_entity . data . title " Home " ) ; ` ` `