Trait DatabaseError

Source
pub trait DatabaseError<T, E> {
    // Required methods
    fn tern_result(self) -> TernResult<T>;
    fn void_tern_result(self) -> TernResult<()>;
    fn tern_migration_result<M: Migration + ?Sized>(
        self,
        migration: &M,
    ) -> TernResult<T>;
    fn void_tern_migration_result<M: Migration + ?Sized>(
        self,
        migration: &M,
    ) -> TernResult<()>;
    fn with_report(self, report: &[MigrationResult]) -> TernResult<T>;
}
Expand description

Converting a result with a generic std::error::Error to one with this crate’s error type.

The *_migration_result methods allow attaching a migration to the error, such as the one being handled when the error occurred. The with_report method allows attaching a slice of MigrationResult to the error to show what collection of the migration set did succeed in being applied before the error was encountered.

Required Methods§

Source

fn tern_result(self) -> TernResult<T>

Convert E to an Error.

Source

fn void_tern_result(self) -> TernResult<()>

Same as tern_result but discard the returned value.

Source

fn tern_migration_result<M: Migration + ?Sized>( self, migration: &M, ) -> TernResult<T>

Convert E to an Error that has a given migration in the error type’s source.

Source

fn void_tern_migration_result<M: Migration + ?Sized>( self, migration: &M, ) -> TernResult<()>

Same as tern_migration_result but discard the returned value.

Source

fn with_report(self, report: &[MigrationResult]) -> TernResult<T>

Attach an array of MigrationResult, representing a partially successful migration operation, to the error.

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, E> DatabaseError<T, E> for Result<T, E>
where E: StdError + Send + Sync + 'static,

Implementors§