cartulary 0.3.0-alpha.1

The knowledge layer of your project — decisions, issues, docs, all in one place.
Documentation
//! Provenance tag carried by every entry a scanner reports.
//!
//! See ISSUE-01F8K0WCA2BNB for the full design: a workspace may merge
//! records from its writable home with read-only union sources. Each
//! scanned entry tells consumers which side it came from, so reads can
//! display it, writes can refuse it, and link rules can apply the
//! asymmetric cross-reference policy.

/// Where a scanned entry was sourced from.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, serde::Serialize)]
#[serde(rename_all = "snake_case", tag = "kind", content = "name")]
pub enum EntryOrigin {
    /// The workspace's primary, writable home.
    #[default]
    Local,
    /// A read-only union side merged in for reads. `name` is the
    /// adapter-built identifier of the union root (typically the
    /// configured directory path).
    Union { name: String },
}

impl EntryOrigin {
    pub fn is_local(&self) -> bool {
        matches!(self, EntryOrigin::Local)
    }

    pub fn is_union(&self) -> bool {
        matches!(self, EntryOrigin::Union { .. })
    }
}