pub trait RepositoryApiFallback {
// Required methods
fn with_fallback<F, Fut, T>(
&mut self,
operation: F,
) -> impl Future<Output = Result<T>> + Send
where F: FnMut(&mut Self) -> Fut + Send,
Fut: Future<Output = Result<T>> + Send,
T: Send + 'static;
fn ensure_provider_with_fallback(
&mut self,
) -> impl Future<Output = Result<bool>> + Send;
}Expand description
Extension trait for RepositoryApi to add fallback support
Required Methods§
Sourcefn with_fallback<F, Fut, T>(
&mut self,
operation: F,
) -> impl Future<Output = Result<T>> + Send
fn with_fallback<F, Fut, T>( &mut self, operation: F, ) -> impl Future<Output = Result<T>> + Send
Perform operation with automatic fallback.
Executes the closure; if it fails with a network-related error and the current provider is cloud/remote, offers fallback to local. On successful fallback, retries the operation once.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".