Crate ordered_stream[][src]

Expand description

Streams that produce elements with an associated ordering.

Say you have a bunch of events that all have a timestamp, sequence number, or other ordering attribute. If you get these events from multiple Streams, then you should be able to produce a “composite” stream by joining each of the individual streams, so long as each originating stream is ordered.

However, if you actually implement this, you discover that you need to buffer at least one element from each stream in order to avoid ordering inversions if the sources are independent (including just running in different tasks). This presents a problem if one of the sources rarely produces events: that slow source can stall all other streams in order to handle the case where the slowness is due to an earlier element instead of just having no elements.

The OrderedStream trait provides a way to solve this problem: if you can ask a stream if it will ever have any events that should be delivered before a given event, then you can often avoid blocking the composite stream when data is ready.

Structs

A stream for the filter function.

A stream for the filter_map function.

An OrderedStream wrapper around an OrderedFuture.

An OrderedStream wrapper around a Stream.

A Stream for the into_ordering function.

A Stream for the into_stream function.

A stream for the join function.

A stream for the map function.

A stream for the map_item function.

A stream for the map_ordering function.

A future for the next function.

A future for the next_before function.

A stream for the then function.

Enums

The result of a OrderedStream::poll_next_before operation.

Traits

An OrderedStream that tracks if the underlying stream should be polled.

A Future that produces an item with an associated ordering.

A stream that produces items that are ordered according to some token.

Helpers for chaining OrderedStreams.

Functions

Join two streams while preserving the overall ordering of elements.