[][src]Struct gazetta::model::Source

pub struct Source<SourceMeta = (), EntryMeta = ()> where
    EntryMeta: Meta,
    SourceMeta: Meta
{ pub title: String, pub root: PathBuf, pub origin: String, pub prefix: String, pub entries: Vec<Entry<EntryMeta>>, pub static_entries: Vec<StaticEntry>, pub stylesheets: Vec<PathBuf>, pub javascript: Vec<PathBuf>, pub icon: Option<PathBuf>, pub well_known: Option<PathBuf>, pub meta: SourceMeta, }

The Source object reads and interprets a source directory.

The fields are intentionally public. Feel free to manually generate or modify this structure.

Fields

title: String

The website's title.

By default, this field is read from gazetta.yaml.

root: PathBuf

The source root directory.

This is specified on construction.

origin: String

The website origin (http://mydomain.com:1234)

By default, this field is derived from the value of base in gazetta.yaml.

prefix: String

The directory under the origin at which this site will be hosted (e.g. "/").

By default, this field is derived from the value of base in gazetta.yaml.

entries: Vec<Entry<EntryMeta>>

The website content to be rendered.

By default, this list is populated with Entries generated from files with the basename index under the root directory excluding:

  1. Files under directories named "static".

  2. Files under assets/.

static_entries: Vec<StaticEntry>

The website content to be deployed as-is (no rendering).

By default, this list is populated with directories under the root directory named "static" excluding:

  1. Directories under directories named "static".

  2. Directories under assets/.

stylesheets: Vec<PathBuf>

The website stylesheets. When rendered, these will be concatinated into a single stylesheet.

By default, this list is populated by the files in is assets/stylesheets/ in lexicographical order.

javascript: Vec<PathBuf>

The website javascript. When rendered, these will be concatenated into a single javascript file.

By default, this list is populated by the files in is assets/javascript/ in lexicographical order.

icon: Option<PathBuf>

The path to the website's icon.

By default, this points to assets/icon.png (if it exists).

well_known: Option<PathBuf>

The path to the .well-known directory.

By default, this points to .well-known.

meta: SourceMeta

Additional metadata read from gazetta.yaml.

Methods

impl<SourceMeta, EntryMeta> Source<SourceMeta, EntryMeta> where
    EntryMeta: Meta,
    SourceMeta: Meta
[src]

pub fn build_index(&self, entry: &Entry<EntryMeta>) -> Vec<&Entry<EntryMeta>>[src]

Build an index for an entry.

This index includes all entries that "cc" this entry and all entries specified in this entry's index pattern.

pub fn new<P>(
    root: P
) -> Result<Source<SourceMeta, EntryMeta>, AnnotatedError<SourceError>> where
    P: AsRef<Path>, 
[src]

Parse a source directory to create a new source.

pub fn reload(&mut self) -> Result<(), AnnotatedError<SourceError>>[src]

Reload from the source directory.

Call this after changing source files.

Trait Implementations

impl<SourceMeta, EntryMeta> Clone for Source<SourceMeta, EntryMeta> where
    EntryMeta: Clone + Meta,
    SourceMeta: Clone + Meta
[src]

impl<SourceMeta, EntryMeta> Debug for Source<SourceMeta, EntryMeta> where
    EntryMeta: Debug + Meta,
    SourceMeta: Debug + Meta
[src]

Auto Trait Implementations

impl<SourceMeta, EntryMeta> Send for Source<SourceMeta, EntryMeta> where
    EntryMeta: Send,
    SourceMeta: Send

impl<SourceMeta, EntryMeta> Unpin for Source<SourceMeta, EntryMeta> where
    EntryMeta: Unpin,
    SourceMeta: Unpin

impl<SourceMeta, EntryMeta> Sync for Source<SourceMeta, EntryMeta> where
    EntryMeta: Sync,
    SourceMeta: Sync

impl<SourceMeta, EntryMeta> UnwindSafe for Source<SourceMeta, EntryMeta> where
    EntryMeta: UnwindSafe,
    SourceMeta: UnwindSafe

impl<SourceMeta, EntryMeta> RefUnwindSafe for Source<SourceMeta, EntryMeta> where
    EntryMeta: RefUnwindSafe,
    SourceMeta: RefUnwindSafe

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]