pub struct Parser<'a> { /* private fields */ }
Expand description
Parses Post
objects from source files.
Implementations§
Source§impl<'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]
---
# Hello
World
Auto Trait Implementations§
impl<'a> Freeze for Parser<'a>
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§
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more