Trait ToStreamAsync

Source
pub trait ToStreamAsync<T: Timestamp, D: Data> {
    // Required method
    fn to_stream<S: Scope<Timestamp = T>>(self, scope: &S) -> Stream<S, D>;
}
Expand description

Converts to a timely Stream.

Required Methods§

Source

fn to_stream<S: Scope<Timestamp = T>>(self, scope: &S) -> Stream<S, D>

Converts a native Stream of Events into a timely Stream.

§Examples
use futures_util::stream;

use timely::dataflow::operators::{Capture, Event, ToStream, ToStreamAsync};
use timely::dataflow::operators::capture::Extract;

let native_stream = stream::iter(vec![
    Event::Message(0, 0),
    Event::Message(0, 1),
    Event::Message(0, 2),
    Event::Progress(Some(0)),
]);

let (data1, data2) = timely::example(|scope| {
    let data1 = native_stream.to_stream(scope).capture();
    let data2 = vec![0,1,2].to_stream(scope).capture();

    (data1, data2)
});

assert_eq!(data1.extract(), data2.extract());

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.

Implementors§

Source§

impl<T, D, F, I> ToStreamAsync<T, D> for I
where D: Data, T: Timestamp, F: IntoIterator<Item = T>, I: Stream<Item = Event<F, D>> + Unpin + 'static,