Struct futhorc::write::Writer

source ·
pub struct Writer<'a> {
    pub posts_template: &'a Template,
    pub index_template: &'a Template,
    pub index_base_url: &'a Url,
    pub index_output_directory: &'a Path,
    pub index_page_size: usize,
    pub home_page: &'a Url,
    pub static_url: &'a Url,
    pub atom_url: &'a Url,
}
Expand description

Responsible for indexing, templating, and writing HTML pages to disk from Post sources.

Fields§

§posts_template: &'a Template

The template for post pages.

§index_template: &'a Template

The template for index pages.

§index_base_url: &'a Url

The base URL for index pages. The main index pages will be located at {index_base_url}/index.html, {index_base_url/1.html}, etc. The tag index pages will be located at {index_base_url}/{tag_name}/index.html, {index_base_url}/ {tag_name}/1.html, etc.

§index_output_directory: &'a Path

The directory in which the index HTML files will be written. The main index page files will be located at {index_output_directory}/index.html, {index_output_directory}/1.html, etc. The tag index page files will be located at {index_output_directory}/{tag_name}/index. html, {index_output_directory}/{tag_name}/1.html,

§index_page_size: usize

The number of posts per index page.

§home_page: &'a Url

The URL for the site’s home page. This is made available to both post and index templates, typically as the destination for the site-header link.

§static_url: &'a Url

The URL for the static assets. This is made available to both post and index templates, typically for the theme’s stylesheet.

§atom_url: &'a Url

The URL for the atom feed. This is made available to both post and index templates, although typically it is only used by the index templates to link to the atom feed.

Implementations§

source§

impl Writer<'_>

source

pub fn write_posts(&self, posts: &[Post]) -> Result<(), Error>

Takes a slice of Post, indexes it by tag, and writes post and index pages to disk.

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Writer<'a>

§

impl<'a> Send for Writer<'a>

§

impl<'a> Sync for Writer<'a>

§

impl<'a> Unpin for Writer<'a>

§

impl<'a> UnwindSafe for Writer<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.