pub struct ParsedDocument { /* private fields */ }Expand description
A parsed markdown document with frontmatter
Implementations§
Source§impl ParsedDocument
impl ParsedDocument
Sourcepub fn new(fields: HashMap<String, QuillValue>) -> Self
pub fn new(fields: HashMap<String, QuillValue>) -> Self
Create a new ParsedDocument with the given fields
Sourcepub fn with_quill_tag(
fields: HashMap<String, QuillValue>,
quill_tag: Option<String>,
) -> Self
pub fn with_quill_tag( fields: HashMap<String, QuillValue>, quill_tag: Option<String>, ) -> Self
Create a ParsedDocument from fields and optional quill tag
Sourcepub fn from_markdown(markdown: &str) -> Result<Self, ParseError>
pub fn from_markdown(markdown: &str) -> Result<Self, ParseError>
Create a ParsedDocument from markdown string
Sourcepub fn get_field(&self, name: &str) -> Option<&QuillValue>
pub fn get_field(&self, name: &str) -> Option<&QuillValue>
Get a specific field
Sourcepub fn fields(&self) -> &HashMap<String, QuillValue>
pub fn fields(&self) -> &HashMap<String, QuillValue>
Get all fields (including body)
Sourcepub fn with_defaults(
&self,
field_schemas: &HashMap<String, FieldSchema>,
) -> Self
pub fn with_defaults( &self, field_schemas: &HashMap<String, FieldSchema>, ) -> Self
Create a new ParsedDocument with default values applied from field schemas
This method creates a new ParsedDocument with default values applied for any fields that are missing from the original document but have defaults specified in the field schemas. Existing fields are preserved and not overwritten.
§Arguments
field_schemas- A HashMap of field schemas containing default values
§Returns
A new ParsedDocument with defaults applied for missing fields
Trait Implementations§
Source§impl Clone for ParsedDocument
impl Clone for ParsedDocument
Source§fn clone(&self) -> ParsedDocument
fn clone(&self) -> ParsedDocument
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 moreAuto Trait Implementations§
impl Freeze for ParsedDocument
impl RefUnwindSafe for ParsedDocument
impl Send for ParsedDocument
impl Sync for ParsedDocument
impl Unpin for ParsedDocument
impl UnwindSafe for ParsedDocument
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