logo
pub struct ReadStream<D: Data> { /* private fields */ }
Expand description

A ReadStream allows operators to pull Messages from a stream.

Example

The following example shows an operator that prints out messages received from a ReadStream.

struct PrintMessageOperator<D: Data> {
    phantom: PhantomData<D>,
}

impl<D: Data> Sink<(), D> for PrintMessageOperator<D> {
    fn run(&mut self, config: &OperatorConfig, read_stream: &mut ReadStream<D>) {
        while let Ok(message) = read_stream.read() {
            println!("Recieved message: {:?}", message);
        }
    }
}

The examples in ExtractStream show how to pull data from a stream in the driver.

Implementations

Returns true if a top watermark message was sent or the ReadStream failed to set up.

Non-blocking read from the ReadStream.

Returns the Message available on the ReadStream, or an Empty if no message is available.

Blocking read from the ReadStream.

Returns the Message available on the ReadStream.

Get the ID given to the stream by the constructor.

Get the name of the stream.

Trait Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more