Sha256: 3aac687856c035517fae44ed2906dd4a1e3184bae4bf613adcdeb73f74126c57

Contents?: true

Size: 1.31 KB

Versions: 8

Compression:

Stored size: 1.31 KB

Contents

use lib::{Debug, Display};

/// Either a re-export of std::error::Error or a new identical trait, depending
/// on whether Serde's "std" feature is enabled.
///
/// Serde's error traits [`serde::ser::Error`] and [`serde::de::Error`] require
/// [`std::error::Error`] as a supertrait, but only when Serde is built with
/// "std" enabled. Data formats that don't care about no\_std support should
/// generally provide their error types with a `std::error::Error` impl
/// directly:
///
/// ```edition2018
/// #[derive(Debug)]
/// struct MySerError {...}
///
/// impl serde::ser::Error for MySerError {...}
///
/// impl std::fmt::Display for MySerError {...}
///
/// // We don't support no_std!
/// impl std::error::Error for MySerError {}
/// ```
///
/// Data formats that *do* support no\_std may either have a "std" feature of
/// their own:
///
/// ```toml
/// [features]
/// std = ["serde/std"]
/// ```
///
/// ```edition2018
/// #[cfg(feature = "std")]
/// impl std::error::Error for MySerError {}
/// ```
///
/// ... or else provide the std Error impl unconditionally via Serde's
/// re-export:
///
/// ```edition2018
/// impl serde::ser::StdError for MySerError {}
/// ```
pub trait Error: Debug + Display {
    /// The underlying cause of this error, if any.
    fn source(&self) -> Option<&(Error + 'static)> {
        None
    }
}

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
wasmtime-9.0.1 ./ext/cargo-vendor/serde-1.0.163/src/std_error.rs
wasmtime-8.0.0 ./ext/cargo-vendor/serde-1.0.160/src/std_error.rs
wasmtime-7.0.0 ./ext/cargo-vendor/serde-1.0.159/src/std_error.rs
wasmtime-6.0.1 ./ext/cargo-vendor/serde-1.0.152/src/std_error.rs
wasmtime-6.0.0 ./ext/cargo-vendor/serde-1.0.152/src/std_error.rs
wasmtime-5.0.0 ./ext/cargo-vendor/serde-1.0.152/src/std_error.rs
wasmtime-0.4.1 ./ext/cargo-vendor/serde-1.0.149/src/std_error.rs
wasmtime-0.4.0 ./ext/cargo-vendor/serde-1.0.149/src/std_error.rs