Cotton code
31 lines · 1.3 KB · RustRaw
//! The refusals of a memory sentence, in the shell's lines: a technical one//! and one that holds a credential. The marks themselves are cotton-rules'//! (`memory_technical`, `memory_briefing::looks_like_secret`).pub use cotton_rules::memory_briefing::SecretKind;pub use cotton_rules::memory_technical::{technical_mark, TechnicalMark};use super::shell_lines::{self, LineRow};/// The refusal `remember` and `memory_update` answer with, naming the decision/// log as the place for the sentence.pub fn technical_refusal(mark: TechnicalMark, rows: &[LineRow]) -> String {    let say = |line: &str, fills: &[(&str, &str)]| {        shell_lines::resolve("refusal", line, rows, fills).unwrap_or_else(|| format!("refusal.{line}"))    };    say("memory.technical.refusal", &[("mark", &say(mark.line(), &[]))])}/// The refusal a write naming this credential kind answers, in `rows`'/// words, the kit's for a line they have none of.#[must_use]pub fn secret_refusal(kind: SecretKind, rows: &[LineRow]) -> String {    let say = |line: &str, fills: &[(&str, &str)]| {        shell_lines::resolve("refusal", line, rows, fills).unwrap_or_else(|| format!("refusal.{line}"))    };    say("memory.secret.refusal", &[("kind", &say(kind.line_key(), &[]))])}#[cfg(test)]#[path = "memory_technical_tests.rs"]mod tests;