Skip to content
masterclass Buddy

Rust · Trait

Error

Rust's Error trait defines the common interface for error values. Implementors provide Debug and Display, and may expose a lower-level cause through source.

Last updated

Since
1.0.0

Syntax

pub trait Error: Debug + Display {
    fn source(&self) -> Option<&(dyn Error + 'static)>;
}

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • Result
  • Debug
  • Display
  • Error::source
  • Error::is
  • Error::downcast_ref
  • Error::downcast_mut
  • Error::downcast

Source: Error in std::error - Rust. Checked 2026-11-03.