Struct shtola::Shtola[][src]

pub struct Shtola { /* fields omitted */ }
Expand description

The main library struct.

Implementations

Creates a new empty Shtola struct.

Appends glob-matched paths to the ignore list. If a glob path matches, the file is excluded from the IR.

use shtola::Shtola;

let mut m = Shtola::new();
m.ignores(&mut vec!["node_modules".into(), "vendor/bundle/".into()])

Sets the source directory to read from. Should be relative.

Sets the destination path to write to. This directory will be created on calling this function if it doesn’t exist.

Sets whether the destination directory should be removed before building. The removal only happens once calling Shtola::build. Default is false.

Sets whether frontmatter should be parsed. Default is true.

Registers a new plugin function in its middleware chain.

use shtola::{Shtola, RefIR};

let mut m = Shtola::new();
let plugin = Box::new(|mut ir: RefIR| ());
m.register(plugin);

Performs the build process. This does a couple of things:

  • If Shtola::clean is set, removes and recreates the destination directory
  • Reads from the source file and ignores files as it’s been configured
  • Parses front matter for the remaining files
  • Runs the middleware chain, executing all plugins
  • Writes the result back to the destination directory

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.