pub trait RunnableExt<I, O>: Runnable<I, O> + Sized{
// Provided methods
fn pipe<R2, O2>(self, next: R2) -> Pipe<Self, R2, I, O, O2>
where R2: Runnable<O, O2>,
O2: Send + 'static { ... }
fn with_retry(self, policy: RetryPolicy) -> Retry<Self, I, O>
where I: Clone { ... }
fn with_max_retries(self, attempts: u32) -> Retry<Self, I, O>
where I: Clone { ... }
fn with_timeout(self, duration: Duration) -> Timeout<Self, I, O> { ... }
fn with_fallback<F>(self, fallback: F) -> Fallback<Self, F, I, O>
where F: Runnable<I, O>,
I: Clone { ... }
fn with_memory_cache<K, F>(
self,
key_fn: F,
) -> Cache<Self, I, O, K, MemoryCache<K, O>>
where K: Hash + Eq + Clone + Send + Sync + 'static,
O: Clone + Send + Sync + 'static,
F: Fn(&I) -> K + Send + Sync + 'static { ... }
fn each(self) -> Each<Self, I, O> { ... }
}Expand description
Adds composition + wrapper methods to any Runnable.
Provided Methods§
Sourcefn pipe<R2, O2>(self, next: R2) -> Pipe<Self, R2, I, O, O2>
fn pipe<R2, O2>(self, next: R2) -> Pipe<Self, R2, I, O, O2>
Pipe this runnable into another, building a Pipe<Self, Next>.
Sourcefn with_retry(self, policy: RetryPolicy) -> Retry<Self, I, O>where
I: Clone,
fn with_retry(self, policy: RetryPolicy) -> Retry<Self, I, O>where
I: Clone,
Wrap with a retry policy.
Sourcefn with_max_retries(self, attempts: u32) -> Retry<Self, I, O>where
I: Clone,
fn with_max_retries(self, attempts: u32) -> Retry<Self, I, O>where
I: Clone,
Shortcut: retry with default policy and N attempts.
Sourcefn with_timeout(self, duration: Duration) -> Timeout<Self, I, O>
fn with_timeout(self, duration: Duration) -> Timeout<Self, I, O>
Wrap with a per-call timeout.
Sourcefn with_fallback<F>(self, fallback: F) -> Fallback<Self, F, I, O>
fn with_fallback<F>(self, fallback: F) -> Fallback<Self, F, I, O>
Wrap with a fallback runnable.
Sourcefn with_memory_cache<K, F>(
self,
key_fn: F,
) -> Cache<Self, I, O, K, MemoryCache<K, O>>
fn with_memory_cache<K, F>( self, key_fn: F, ) -> Cache<Self, I, O, K, MemoryCache<K, O>>
Wrap with an in-memory cache keyed by key_fn(&I).
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.