pub fn closed_reason(
code: &str,
details: Option<&Value>,
) -> Option<&'static str>Expand description
The per-code closed reason vocabularies, and the only gate through
which a reason reaches the ledger. Given a refusal’s code and its
structured details, returns the matching engine-source literal
when — and only when — the code has a declared vocabulary AND the
details’ reason value is a member. The return is the vocabulary’s
own &'static str, never the input string, so a caller-influenced
value can only ever select from (not extend) the closed set; any
other value records nothing.
Adding a code here requires its details.reason to be a closed,
engine-defined discriminator (computed at refusal time from engine
state, e.g. SlugError::reason()) — an open-ended or
caller-derived details.reason must NOT be listed.