Crate future_utils

Source

Modules§

bi_channel
mpsc
channels in the futures-rs crate cannot error, yet they return () for their error type for some stupid reason. This is a wrapper around futures-rs unbounded channels which removes the error.

Structs§

Delay
DropNotice
Created in tandem with a DropNotify using the drop_notify function. DropNotice is a future which resolves to () when its corresponding DropNotify is dropped.
DropNotify
Created in tandem with a DropNotice using the drop_notify function. Drop this object to cause its corresponding DropNotice to resolve.
Finally
Wraps a stream or future and runs a callback when the stream/future ends or when Finally is dropped.
Finish
Future yielded by WhileDriving which wraps the future it was driving. Can be resolved to whatever the original future would resolved to or unpacked using into_inner.
FirstOk
Adapts a stream to a future by taking the first successful item yielded by the stream. If the stream ends before yielding an Ok then all the errors that were yielded by the stream are returned in a vector.
FirstOk2
FramedUnbuffered
An alternative to tokio_io’s Framed which doesn’t internally buffer data. This gives it much lower performance but means that you can use .into_inner() without losing data.
Infallible
Wraps a future or stream which can’t fail (ie. has error type Void) and casts the error type to some inferred type.
LogError
Wraps a future which returns () and logs its error if it fails. LogError itself cannot fail and will always resolve to ().
LogErrors
Removes the errors from a stream and logs them.
NextOrElse
Takes the next item from the stream. If the stream ends then the provided callback is used to generate an error.
ResumeUnwind
Propogates the result of a .catch_unwind, panicking if the future resolves to an Err
ThreadFuture
Wraps a synchronous function into a future by running it in its own thread. Created using thread_future.
Until
Runs a stream or future until some condition is met.
WhileDriving
WithReadinessTimeout
WithTimeout

Enums§

FinishInner

Traits§

FutureExt
Extension trait for Future.
StreamExt
Extension trait for Stream.

Functions§

drop_notify
Create a (DropNotify, DropNotice) pair. DropNotice is a future that resolves to () when the corresponding DropNotify is dropped.
thread_future
Run a synchronous function in a separate thread and return its result as a Future.

Type Aliases§

BoxFuture
BoxSendFuture
BoxSendSink
BoxSendStream
BoxSink
BoxStream
IoFuture
IoSink
IoStream