pub struct Parser<'a> { /* private fields */ }
Expand description
Parses Post
objects from source files.
Implementations
sourceimpl<'a> Parser<'a>
impl<'a> Parser<'a>
sourcepub fn new(
index_url: &'a Url,
posts_url: &'a Url,
posts_directory: &'a Path
) -> Parser<'a>
pub fn new(
index_url: &'a Url,
posts_url: &'a Url,
posts_directory: &'a Path
) -> Parser<'a>
Constructs a new parser. See fields on Parser
for argument descriptions.
sourcepub fn parse_posts(&self, source_directory: &Path) -> Result<Vec<Post>>
pub fn parse_posts(&self, source_directory: &Path) -> Result<Vec<Post>>
Searches a provided source_directory
for post files (extension = .md
)
and returns a list of Post
objects sorted by date (most recent
first). Each post file must be structured as follows:
- Initial frontmatter fence (
---
) - YAML frontmatter with fields
Title
,Date
, and optionallyTags
- Terminal frontmatter fence (
---
) - Post body
For example:
---
Title: Hello, world!
Date: 2021-04-16
Tags: [greet]
---
World
Auto Trait Implementations
impl<'a> RefUnwindSafe for Parser<'a>
impl<'a> Send for Parser<'a>
impl<'a> Sync for Parser<'a>
impl<'a> Unpin for Parser<'a>
impl<'a> UnwindSafe for Parser<'a>
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