Skip to main content

KernelRefusal

Struct KernelRefusal 

Source
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: String

The human text, verbatim. Display prints exactly this.

Implementations§

Source§

impl KernelRefusal

Source

pub fn new( class: RefusalClass, stage: KernelStage, message: impl Into<String>, ) -> Self

Source

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.

Source

pub fn input( stage: KernelStage, what: impl Into<String>, message: impl Into<String>, ) -> Self

A caller error.

Source

pub fn unsupported( stage: KernelStage, what: impl Into<String>, message: impl Into<String>, ) -> Self

A named deferral.

Source

pub fn non_convergence( stage: KernelStage, what: impl Into<String>, message: impl Into<String>, ) -> Self

An iterative lane that ran out of budget.

Source

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

Source§

fn clone(&self) -> KernelRefusal

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for KernelRefusal

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for KernelRefusal

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for KernelRefusal

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for KernelRefusal

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
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.

Source§

fn from(refusal: KernelRefusal) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for KernelRefusal

Source§

fn eq(&self, other: &KernelRefusal) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for KernelRefusal

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for KernelRefusal

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more