Cotton code
44 lines · 2.0 KB · RustRaw
//! The fields a memory write path REFUSES, each with the sentence it answers.//!//! Three of them, each retired by a different change, and each refused rather//! than dropped (R51). A field the schema no longer declares is tempting to//! ignore, on the grounds that the write it rides on is still the owner's own//! words. But a caller that sent one believes it filed something, and a silent//! drop leaves its ledger claiming a write nobody made.//!//! The refusals live here rather than beside each `fail(…)` because the tools//! and their tests both read them, and two copies of a refusal are two//! refusals. Their words are the `refusal` set's `memory.retired` lines.use super::shell_lines::{self, LineRow};/// A field a memory write path refuses, as a typed fact; said to the/// assistant in the database's `refusal` lines (`memory.retired.*`).#[derive(Debug, Clone, Copy, PartialEq, Eq)]pub enum RetiredField {    /// `kind` or `layer` — the columns left the file in schema v14. Its line    /// carries the ONE teaching the retired `kind: technical` refusal used to    /// enforce: a fact a future change can falsify is documentation and    /// belongs in the repo, in a guard.    Taxonomy,    /// `body` — the field left the product.    Body,    /// `dated` — the column left the file in schema v34, with the review date    /// and the widening interval beside it. The replacement is not another    /// field: an entry that is only true for a while SAYS SO IN ITS OWN    /// SENTENCE, and an assistant that reads an expired one archives it.    Dated,}impl RetiredField {    /// The refusal in `rows`' words, the kit's for a line they have none of.    #[must_use]    pub fn say(self, rows: &[LineRow]) -> String {        let line = match self {            RetiredField::Taxonomy => "memory.retired.taxonomy",            RetiredField::Body => "memory.retired.body",            RetiredField::Dated => "memory.retired.dated",        };        shell_lines::resolve("refusal", line, rows, &[]).unwrap_or_else(|| format!("refusal.{line}"))    }}