std/error

Types

Context

pub type Context = {
    // private fields omitted
}

An error built by context(), carrying an outer message and the error it wraps.

Context.message

pub fn Context.message(self) -> String

Context.inner

pub fn Context.inner(move self) -> Error

The error this Context wraps.

Functions

context

pub fn context(e: Error, message: String) -> Error

Wraps e so that its message reads message: <original message>.

cause

pub fn cause(e: Error) -> Error?

The error e wraps, or None when e was not built by context().

as

pub fn as[E](e: &Error) -> E?

Downcasts e to E: the concrete error when the box holds one directly, or one wrapped by context() anywhere down the chain (first match wins). E must be a concrete Copy type implementing Error, extracted from behind a shared borrow, so a move-only E is rejected.