Skip to main content

Watcher

Struct Watcher 

Source
pub struct Watcher<'b> { /* private fields */ }
Expand description

Incremental, mtime-polling rebuild state produced by Builder::watch.

No background thread and no dependency on an async runtime or notify — a caller drives progress by calling Watcher::tick on whatever cadence it wants (a blocking loop with std::thread::sleep, a GUI’s idle callback, a test). This matches mini-static’s own poller in spirit (mtime comparison, not OS file-events) while keeping the dependency budget at zero for the default case.

Implementations§

Source§

impl<'b> Watcher<'b>

Source

pub fn tick(&mut self) -> Result<Vec<PathBuf>, DocError>

Polls both watched trees once.

If any template file’s mtime changed (added, removed, or modified), every page is rebuilt — mini-docs doesn’t parse Tera’s {% extends %}/{% include %} graph, so a template-level change conservatively fans out to every dependent rather than risking a stale page. Otherwise, only the .md files whose own mtime changed are rebuilt.

If the .md file set changed at all (any addition, removal, or modification — not just what the render cache decided to rebuild), the data.json index (if Builder::data_json is set) is regenerated too. A template-only change never alters index content, so it doesn’t trigger this.

Returns the .md paths rebuilt this tick (empty if nothing changed).

Auto Trait Implementations§

§

impl<'b> !RefUnwindSafe for Watcher<'b>

§

impl<'b> !UnwindSafe for Watcher<'b>

§

impl<'b> Freeze for Watcher<'b>

§

impl<'b> Send for Watcher<'b>

§

impl<'b> Sync for Watcher<'b>

§

impl<'b> Unpin for Watcher<'b>

§

impl<'b> UnsafeUnpin for Watcher<'b>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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 T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.