pub struct YamlParser;Expand description
Parser for YAML frontmatter
Implementations§
Source§impl YamlParser
impl YamlParser
Sourcepub fn parse<T: DeserializeOwned>(&self, yaml: &str) -> MarkdownConfigResult<T>
pub fn parse<T: DeserializeOwned>(&self, yaml: &str) -> MarkdownConfigResult<T>
Parse YAML string into a typed structure
Sourcepub fn validate_structure(&self, yaml: &str) -> MarkdownConfigResult<()>
pub fn validate_structure(&self, yaml: &str) -> MarkdownConfigResult<()>
Validate YAML structure without deserializing to a specific type
Sourcepub fn has_required_fields(
&self,
yaml: &str,
required_fields: &[&str],
) -> MarkdownConfigResult<()>
pub fn has_required_fields( &self, yaml: &str, required_fields: &[&str], ) -> MarkdownConfigResult<()>
Check if required fields are present in YAML
Sourcepub fn get_field(
&self,
yaml: &str,
field: &str,
) -> MarkdownConfigResult<Option<String>>
pub fn get_field( &self, yaml: &str, field: &str, ) -> MarkdownConfigResult<Option<String>>
Get a field value from YAML
Sourcepub fn validate_schema(
&self,
yaml: &str,
required_fields: &[&str],
) -> MarkdownConfigResult<()>
pub fn validate_schema( &self, yaml: &str, required_fields: &[&str], ) -> MarkdownConfigResult<()>
Validate YAML against a schema (checks for required fields and types)
Sourcepub fn get_all_validation_errors(
&self,
yaml: &str,
required_fields: &[&str],
) -> Vec<MarkdownConfigError>
pub fn get_all_validation_errors( &self, yaml: &str, required_fields: &[&str], ) -> Vec<MarkdownConfigError>
Get all validation errors from YAML
Trait Implementations§
Source§impl Clone for YamlParser
impl Clone for YamlParser
Source§fn clone(&self) -> YamlParser
fn clone(&self) -> YamlParser
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for YamlParser
impl Debug for YamlParser
Auto Trait Implementations§
impl Freeze for YamlParser
impl RefUnwindSafe for YamlParser
impl Send for YamlParser
impl Sync for YamlParser
impl Unpin for YamlParser
impl UnwindSafe for YamlParser
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