cartulary 0.3.0-alpha.1

The knowledge layer of your project — decisions, issues, docs, all in one place.
Documentation
//! Ports for routing site inputs (Markdown pages and static assets)
//! through the domain rather than the CLI helpers. Adapters wrap
//! the filesystem (or the embedded default theme) and stream their
//! entries; the domain only sees [`MarkdownEntry`] and [`Asset`]
//! addressed by [`Source`].
//!
//! Boxed iterators are object-safe and lifetime-bound to the reader,
//! so adapters may borrow internal state (e.g. a walk root) for the
//! duration of the stream without forcing every reader into a single
//! concrete iterator type.

use crate::domain::model::site::{Asset, MarkdownEntry};

/// Stream every Markdown entry exposed by this reader. An item may
/// fail independently (e.g. unreadable file) without aborting the
/// stream; the caller decides how to handle individual errors.
pub trait PagesReader {
    fn entries<'a>(&'a self) -> Box<dyn Iterator<Item = anyhow::Result<MarkdownEntry>> + 'a>;
}

/// Stream every static asset exposed by this reader. Same per-item
/// error contract as [`PagesReader`].
pub trait AssetsReader {
    fn assets<'a>(&'a self) -> Box<dyn Iterator<Item = anyhow::Result<Asset>> + 'a>;
}