[−][src]Struct restartables::Restartable
Wraps an inner future, restarting it until it resolves a value that passes a test, or times out.
This is a Future adaptor, meaning it wraps other futures, like future::map
When this future is polled, it polls the inner future. If the inner futures resolves, its value
is run through a test
closure.
If the test is successful, the value is returned with timing information.
If the test is unsuccessful, the future is recreated and retried.
Because this fail-restart loop could go on forever, you should supply a timeout. If a None
timeout is used, then awaiting the Restartable
is not guaranteed to resolve.
Methods
impl<Fut, Test, Factory, T, E> Restartable<Fut, Test, Factory, T, E> where
Fut: Future,
Factory: Fn() -> Fut,
Test: Fn(Fut::Output) -> Result<T, E>,
[src]
Fut: Future,
Factory: Fn() -> Fut,
Test: Fn(Fut::Output) -> Result<T, E>,
Trait Implementations
impl<Fut, Test, Factory, T, E> Future for Restartable<Fut, Test, Factory, T, E> where
Fut: Future,
Factory: Fn() -> Fut,
Test: Fn(Fut::Output) -> Result<T, E>,
[src]
Fut: Future,
Factory: Fn() -> Fut,
Test: Fn(Fut::Output) -> Result<T, E>,
type Output = Result<Success<T>, Failure<E>>
The type of value produced on completion.
fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output>
[src]
impl<Fut, Test, Factory, T, E> PinnedDrop for Restartable<Fut, Test, Factory, T, E> where
Fut: Future,
Factory: Fn() -> Fut,
Test: Fn(Fut::Output) -> Result<T, E>,
[src]
Fut: Future,
Factory: Fn() -> Fut,
Test: Fn(Fut::Output) -> Result<T, E>,
impl<'pin, Fut, Test, Factory, T, E> Unpin for Restartable<Fut, Test, Factory, T, E> where
Fut: Future,
Factory: Fn() -> Fut,
Test: Fn(Fut::Output) -> Result<T, E>,
__Restartable<'pin, Fut, Test, Factory, T, E>: Unpin,
[src]
Fut: Future,
Factory: Fn() -> Fut,
Test: Fn(Fut::Output) -> Result<T, E>,
__Restartable<'pin, Fut, Test, Factory, T, E>: Unpin,
Auto Trait Implementations
impl<Fut, Test, Factory, T, E> RefUnwindSafe for Restartable<Fut, Test, Factory, T, E> where
Factory: RefUnwindSafe,
Fut: RefUnwindSafe,
Test: RefUnwindSafe,
Factory: RefUnwindSafe,
Fut: RefUnwindSafe,
Test: RefUnwindSafe,
impl<Fut, Test, Factory, T, E> Send for Restartable<Fut, Test, Factory, T, E> where
Factory: Send,
Fut: Send,
Test: Send,
Factory: Send,
Fut: Send,
Test: Send,
impl<Fut, Test, Factory, T, E> Sync for Restartable<Fut, Test, Factory, T, E> where
Factory: Sync,
Fut: Sync,
Test: Sync,
Factory: Sync,
Fut: Sync,
Test: Sync,
impl<Fut, Test, Factory, T, E> UnwindSafe for Restartable<Fut, Test, Factory, T, E> where
Factory: UnwindSafe,
Fut: UnwindSafe,
Test: UnwindSafe,
Factory: UnwindSafe,
Fut: UnwindSafe,
Test: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,