Expand description
Core error types and utilities.
std is on by default; build with default-features = false for no_std +
alloc targets (an allocator is always required — bring your own with
extern crate alloc and a global allocator in the consumer). Backtrace
capture, panic-hook integration, tracing, and clock-based timestamps
(chrono / jiff) require std; under no_std, Backtrace is an
always-empty stub so the rest of the API keeps its shape.
Re-exports§
pub extern crate alloc;
Modules§
- erased
- Serializable, type-erased error representations (the
serdefeature). - extras
- Ready-made
Capturabletypes for ambient process and environment state. - test_
utils - Shared helpers for the integration-test suites of the consumer crates.
- tracing
tracingintegration helpers.
Macros§
- redact
- Run a block with a named
settingsredaction profile bound, so the snapshots asserted inside it use the shared normalization filters. - snap_
name - Build a snapshot name from a base label plus the channel and target triple, keeping platform- and toolchain-specific snapshots in separate files.
- start_
marker - Marks the start of meaningful backtraces on the current thread: frames
below this call are hidden from rendered error and panic traces. The
function containing the call stays visible. A later call replaces the
marker; other threads are unaffected.
RUST_BACKTRACE=fullrenders traces unfiltered, ignoring markers. Hiding is applied by thefancyfeature’s renderers; without that feature the marker is recorded but has no effect.
Structs§
- Backtrace
- A captured stack backtrace with deferred symbol resolution.
- Chain
- An iterator over an error and its chain of
sourcecauses. - Error
Code - An opaque error code, used for programmatic handling and matching.
- Help
Text - User-facing help text, intended to be shown in diagnostics.
- NoSource
- The stand-in “source” a leaf selector (one with no
sourcefield) builds from.Option::contextuses it as the source when there is no error value to attach. You normally reach a leaf error through.build()/.fail()/Option::context, so you rarely name this directly. - Optional
Span Trace - A wrapper around
Option<SpanTrace>that implementsCapturable. - Span
Trace - A wrapper around
tracing_error::SpanTrace. - Welp
- A string-shaped error type for prototypes, one-off errors, and quick string contexts.
Enums§
- Rust
Backtrace - Whether backtrace capture is enabled, and how verbosely it should render.
- Span
Trace Status - The status of a
SpanTrace: whether it was captured, or why it is empty.
Traits§
- AsError
Source - Normalize any source-error value to a
&(dyn Error + 'static). - Capturable
- A value that fills itself in when an error is constructed.
- Contextual
- Builds a target error from a context selector and a source error of type
E. - Diagnostic
- Trait for errors that expose diagnostic data.
- Error
Chain Ext - Walk an error and its
sourcechain. - Option
Ext - Extension trait on
Optionfor convertingNoneinto a typed error. - Result
Ext - Extension trait on
Resultfor ergonomic error context wrapping. - Welp
Option Ext - Extension trait on
Optionfor convertingNoneinto aWelp. - Welp
Result Ext - Extension trait on
Resultfor attaching a string message that produces aWelp.
Functions§
- clear_
rust_ backtrace_ override - Remove any override set by
set_rust_backtrace_overrideon the current thread, revertingrust_backtraceto the environment-derived value. - rust_
backtrace - The effective backtrace setting for the current thread.
- rust_
panic_ backtrace - The effective panic backtrace setting for the current thread: the
thread-local override if present, else
RUST_BACKTRACE(only). - set_
rust_ backtrace_ override - Force
rust_backtraceto returnvalueon the current thread, taking precedence over the environment untilclear_rust_backtrace_override. - with_
rust_ backtrace_ override - Run
fwith the thread’s backtrace setting forced tovalue, restoring the previous override (or lack of one) afterwards — including on unwind.