pub trait StatementCallbackReturnType<S: 'static, C> {
type Return<'a>;
// Required methods
fn from_error<'a>(e: Error) -> Self::Return<'a>;
fn map_to_no_cache<'a>(self) -> Self::Return<'a>
where Self: 'a;
fn map_to_cache(stmt: &mut S, conn: C) -> Self::Return<'_>;
fn register_cache<'a>(
self,
callback: impl FnOnce(S) -> &'a mut S + Send + 'a,
) -> Self::Return<'a>
where Self: 'a;
}
Available on crate feature
i-implement-a-third-party-backend-and-opt-into-breaking-changes
only.Expand description
This trait abstracts over the type returned by the prepare statement function
The main use-case for this abstraction is to share the same statement cache implementation between diesel and diesel-async.
Required Associated Types§
Required Methods§
Sourcefn from_error<'a>(e: Error) -> Self::Return<'a>
fn from_error<'a>(e: Error) -> Self::Return<'a>
Create the return type from an error
Sourcefn map_to_no_cache<'a>(self) -> Self::Return<'a>where
Self: 'a,
fn map_to_no_cache<'a>(self) -> Self::Return<'a>where
Self: 'a,
Map the callback return type to the MaybeCached::CannotCache
variant
Sourcefn map_to_cache(stmt: &mut S, conn: C) -> Self::Return<'_>
fn map_to_cache(stmt: &mut S, conn: C) -> Self::Return<'_>
Map the cached statement to the MaybeCached::Cached
variant
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.