Cotton code
33 lines · 1.5 KB · RustRaw
//! A rollup column whose source tool is not installed in this database//! (coordinator, 14 Oct 2026).//!//! Removing a tool keeps its table definition, so a rollup over it still//! reads (a count of zero, a minimum of nothing) — but the page must say why.//! The engine fills one typed reading, the source table's name, and the//! `everything` definition's `source_absent` column words it: every word of//! the field problem is the definition's, so a rewording is data.use crate::definitions::{key_as_words, TableDefinition};/// The definition that words a field whose source table is absent.pub const WORDING_TABLE: &str = "everything";/// Its column whose `reading` carries the line.pub const WORDING_COLUMN: &str = "source_absent";/// The source table's name as a person reads it: its definition's name when/// the database still holds one, else its id as words.pub fn source_name(source: Option<&TableDefinition>, table: &str) -> String {    source.map(|definition| definition.name.clone()).unwrap_or_else(|| key_as_words(table))}/// The field problem for a rollup over the absent `source` table, worded by/// the `everything` definition's `source_absent` reading. `None` when the/// definition does not word it.pub fn line(wording: &TableDefinition, source: &str) -> Option<String> {    let reading = wording.column(WORDING_COLUMN)?.reading.as_deref()?;    Some(reading.replace("{value}", source))}#[cfg(test)]#[path = "source_absent_tests.rs"]mod tests;