revm_database_interface/
erased_error.rs

1//! Erased error type.
2
3use std::boxed::Box;
4
5/// Erased error type.
6#[derive(thiserror::Error, Debug)]
7#[error(transparent)]
8pub struct ErasedError(Box<dyn core::error::Error + Send + Sync + 'static>);
9
10impl ErasedError {
11    /// Creates a new erased error.
12    pub fn new(error: impl core::error::Error + Send + Sync + 'static) -> Self {
13        Self(Box::new(error))
14    }
15
16    /// Consumes the erased error and returns the inner error.
17    #[inline]
18    pub fn into_inner(self) -> Box<dyn core::error::Error + Send + Sync + 'static> {
19        self.0
20    }
21}