Skip to main content

ErrorBoundary

Struct ErrorBoundary 

Source
pub struct ErrorBoundary { /* private fields */ }
Expand description

Panic-isolating fault boundary protecting callbacks, reactive effects, and render hooks.

Implementations§

Source§

impl ErrorBoundary

Fault-isolation execution, recovery, and telemetry methods for ErrorBoundary.

Source

pub fn named<NameType>(name: NameType) -> Self
where NameType: Into<String>,

Creates a named ErrorBoundary with default consecutive-fault and history limits.

§Arguments
  • NameType - Diagnostic boundary name.
§Returns
  • Self - Healthy named error boundary.
Source

pub fn with_limits<NameType>( name: NameType, max_consecutive_faults: u32, history_limit: usize, ) -> Self
where NameType: Into<String>,

Creates a named ErrorBoundary with explicit consecutive-fault trip threshold and history capacity.

§Arguments
  • NameType - Diagnostic boundary name.
  • u32 - Consecutive panic threshold triggering ErrorBoundaryState::Tripped (clamped to >= 1).
  • usize - Maximum number of recent FaultRecord items kept in memory.
§Returns
  • Self - Configured healthy error boundary.
Source

pub fn guard<CallbackFn, ReturnValue>( &mut self, origin: FaultOrigin, scope: &str, timestamp_ms: u64, operation: CallbackFn, ) -> Result<ReturnValue, FaultRecord>
where CallbackFn: FnOnce() -> ReturnValue,

Executes operation inside catch_unwind, updating fault telemetry and returning a structured FaultRecord on panic.

§Arguments
  • FaultOrigin - Runtime site category for fault attribution.
  • &str - Component, effect, or task scope label.
  • u64 - Monotonic timestamp in milliseconds.
  • CallbackFn - Protected closure to execute.
§Returns
  • Result<ReturnValue, FaultRecord> - Operation return value or captured fault record.
Source

pub fn guard_or<CallbackFn, FallbackFn, ReturnValue>( &mut self, origin: FaultOrigin, scope: &str, timestamp_ms: u64, operation: CallbackFn, fallback: FallbackFn, ) -> ReturnValue
where CallbackFn: FnOnce() -> ReturnValue, FallbackFn: FnOnce(&FaultRecord) -> ReturnValue,

Executes operation under panic isolation, invoking fallback with the captured FaultRecord if it panics.

§Arguments
  • FaultOrigin - Runtime site category for fault attribution.
  • &str - Component, effect, or task scope label.
  • u64 - Monotonic timestamp in milliseconds.
  • CallbackFn - Protected primary closure.
  • FallbackFn - Recovery closure invoked with &FaultRecord on panic.
§Returns
  • ReturnValue - Primary result or fallback recovery result.
Source

pub fn recover(&mut self) -> bool

Resets a Degraded or Tripped boundary back to Healthy, clearing its consecutive fault counter.

§Returns
  • bool - true when the boundary transitioned out of a faulted state.
Source

pub fn is_tripped(&self) -> bool

Returns true when the boundary has reached its consecutive-fault trip threshold.

§Returns
  • bool - true when state == ErrorBoundaryState::Tripped.
Source

pub fn last_fault(&self) -> Option<&FaultRecord>

Returns the most recently intercepted fault record, if any.

§Returns
  • Option<&FaultRecord> - Latest fault record in the history ring.
Source

pub fn recent_faults(&self) -> Vec<FaultRecord>

Returns an ordered snapshot of all retained recent fault records (oldest first).

§Returns
  • Vec<FaultRecord> - Retained fault history snapshot.
Source

pub fn telemetry(&self) -> ErrorBoundaryTelemetry

Captures a compact copyable telemetry snapshot of this error boundary.

§Returns
  • ErrorBoundaryTelemetry - Current health state and fault counters.
Source§

impl ErrorBoundary

Implements impl #impl_generics #name #ty_generics #where_clause.

Source

pub fn get_name(&self) -> &String

Source

pub fn get_mut_name(&mut self) -> &mut String

Source

pub fn set_name(&mut self, val: String) -> &mut Self

Source

pub fn get_state(&self) -> ErrorBoundaryState

Source

pub fn get_mut_state(&mut self) -> &mut ErrorBoundaryState

Source

pub fn set_state(&mut self, val: ErrorBoundaryState) -> &mut Self

Source

pub fn get_max_consecutive_faults(&self) -> u32

Source

pub fn get_mut_max_consecutive_faults(&mut self) -> &mut u32

Source

pub fn set_max_consecutive_faults(&mut self, val: u32) -> &mut Self

Source

pub fn get_history_limit(&self) -> usize

Source

pub fn get_mut_history_limit(&mut self) -> &mut usize

Source

pub fn set_history_limit(&mut self, val: usize) -> &mut Self

Source

pub fn get_total_faults(&self) -> u64

Source

pub fn get_mut_total_faults(&mut self) -> &mut u64

Source

pub fn set_total_faults(&mut self, val: u64) -> &mut Self

Source

pub fn get_consecutive_faults(&self) -> u32

Source

pub fn get_mut_consecutive_faults(&mut self) -> &mut u32

Source

pub fn set_consecutive_faults(&mut self, val: u32) -> &mut Self

Source

pub fn get_recoveries(&self) -> u64

Source

pub fn get_mut_recoveries(&mut self) -> &mut u64

Source

pub fn set_recoveries(&mut self, val: u64) -> &mut Self

Source

pub fn get_successful_invocations(&self) -> u64

Source

pub fn get_mut_successful_invocations(&mut self) -> &mut u64

Source

pub fn set_successful_invocations(&mut self, val: u64) -> &mut Self

Trait Implementations§

Source§

impl Clone for ErrorBoundary

Source§

fn clone(&self) -> Self

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 ErrorBoundary

Source§

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

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

impl Default for ErrorBoundary

Default healthy ErrorBoundary configured with standard history and trip limits.

Source§

fn default() -> Self

Creates a default healthy ErrorBoundary.

§Returns
  • Self - Healthy error boundary using default limits.

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> 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, 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.