DbErrorContext

Trait DbErrorContext 

Source
pub trait DbErrorContext<Output>: Sized {
    // Required method
    fn with_db_context<D>(self, context: impl FnOnce() -> D) -> Output
       where D: Display;

    // Provided method
    fn db_context<D>(self, context: D) -> Output
       where D: Display { ... }
}
Expand description

Extension trait for .db_context() and .with_db_context()

Required Methods§

Source

fn with_db_context<D>(self, context: impl FnOnce() -> D) -> Output
where D: Display,

Returns the error, or result, with more context (from a closure)

If necessary, converts a rusqlite::Error to a DbSqlError.

Provided Methods§

Source

fn db_context<D>(self, context: D) -> Output
where D: Display,

Returns the error, or result, with more context

If necessary, converts a rusqlite::Error to a DbSqlError.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<E> DbErrorContext<DbError<E>> for Error

Source§

fn with_db_context<D>(self, context: impl FnOnce() -> D) -> DbError<E>
where D: Display,

Source§

impl<T, E, F> DbErrorContext<Result<T, F>> for Result<T, E>
where E: DbErrorContext<F>,

Source§

fn with_db_context<D>(self, context: impl FnOnce() -> D) -> Result<T, F>
where D: Display,

Implementors§