pub struct KernelRefusal {
pub class: RefusalClass,
pub stage: KernelStage,
pub message: String,
}Expand description
A kernel REFUSAL: the fail-safe contract’s carrier. The kernel never
degrades a result; where it cannot certify one it refuses, and this is the
refusal — a closed RefusalClass that consumers dispatch on (the boolean’s
perturbation-retry gate, the CI baseline’s per-class diff), the stage that
minted it, and the human text, which Display prints verbatim so every
message a user or a test saw before typing is unchanged.
There is deliberately no From<String> for this type: a refusal is minted
at its origin with a class, never re-derived from prose. The only string
conversion is the lossy exit (From<KernelRefusal> for String) that
stringly callers above the boolean stack still use; those callers are
retired stack by stack (offset/fillet/heal, then the feature pipeline).
Fields§
§class: RefusalClass§stage: KernelStage§message: StringThe human text, verbatim. Display prints exactly this.
Implementations§
Source§impl KernelRefusal
impl KernelRefusal
pub fn new( class: RefusalClass, stage: KernelStage, message: impl Into<String>, ) -> Self
Sourcepub fn internal(
stage: KernelStage,
what: impl Into<String>,
message: impl Into<String>,
) -> Self
pub fn internal( stage: KernelStage, what: impl Into<String>, message: impl Into<String>, ) -> Self
An internal consistency failure. what is a short stable slug (the
check that tripped), the message the full text.
Sourcepub fn input(
stage: KernelStage,
what: impl Into<String>,
message: impl Into<String>,
) -> Self
pub fn input( stage: KernelStage, what: impl Into<String>, message: impl Into<String>, ) -> Self
A caller error.
Sourcepub fn unsupported(
stage: KernelStage,
what: impl Into<String>,
message: impl Into<String>,
) -> Self
pub fn unsupported( stage: KernelStage, what: impl Into<String>, message: impl Into<String>, ) -> Self
A named deferral.
Sourcepub fn non_convergence(
stage: KernelStage,
what: impl Into<String>,
message: impl Into<String>,
) -> Self
pub fn non_convergence( stage: KernelStage, what: impl Into<String>, message: impl Into<String>, ) -> Self
An iterative lane that ran out of budget.
Sourcepub fn with_message(self, f: impl FnOnce(&str) -> String) -> Self
pub fn with_message(self, f: impl FnOnce(&str) -> String) -> Self
The same refusal with its message rewritten by f — the way a wrapping
site adds context (“assembly failed: …”) WITHOUT changing the class, so
an inner degeneracy stays retry-eligible through every wrapper exactly
as the substring matcher saw it in the wrapped text.
Trait Implementations§
Source§impl Clone for KernelRefusal
impl Clone for KernelRefusal
Source§fn clone(&self) -> KernelRefusal
fn clone(&self) -> KernelRefusal
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for KernelRefusal
impl Debug for KernelRefusal
Source§impl<'de> Deserialize<'de> for KernelRefusal
impl<'de> Deserialize<'de> for KernelRefusal
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for KernelRefusal
impl Display for KernelRefusal
Source§impl Error for KernelRefusal
impl Error for KernelRefusal
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<KernelRefusal> for String
The lossy exit for stringly callers: the class is dropped, the text kept.
Legal only ABOVE the typed stacks (never inside csg/ or the healing
modules that mint refusals); each stack that adopts KernelRefusal
removes its uses.
impl From<KernelRefusal> for String
The lossy exit for stringly callers: the class is dropped, the text kept.
Legal only ABOVE the typed stacks (never inside csg/ or the healing
modules that mint refusals); each stack that adopts KernelRefusal
removes its uses.