Trait SqlError

Source
pub trait SqlError: Sized {
    // Required methods
    fn fk_violation<E, F: FnOnce() -> E>(self, f: F) -> Result<Self, E>;
    fn unique_violation<E, F: FnOnce() -> E>(self, f: F) -> Result<Self, E>;
}
Expand description

Trait for mapping certain postgres errors.

Required Methods§

Source

fn fk_violation<E, F: FnOnce() -> E>(self, f: F) -> Result<Self, E>

Map a foreign key violation to a different error type.

Source

fn unique_violation<E, F: FnOnce() -> E>(self, f: F) -> Result<Self, E>

Map a unique violation to a different error type.

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<T> SqlError for Result<T, Error>

Source§

fn fk_violation<E, F: FnOnce() -> E>(self, f: F) -> Result<Self, E>

Source§

fn unique_violation<E, F: FnOnce() -> E>(self, f: F) -> Result<Self, E>

Implementors§