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>
impl<'b> Watcher<'b>
Sourcepub fn tick(&mut self) -> Result<Vec<PathBuf>, DocError>
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).