Skip to main content

Stream

Trait Stream 

Source
pub trait Stream: Object {
    // Required method
    fn next(&self, cx: &mut Cx) -> Result<Option<Value>>;

    // Provided method
    fn close(&self, _cx: &mut Cx) -> Result<()> { ... }
}
Expand description

A runtime object that yields values one at a time until it is closed.

Required Methods§

Source

fn next(&self, cx: &mut Cx) -> Result<Option<Value>>

Pulls the next value, or Ok(None) once the stream is exhausted.

Provided Methods§

Source

fn close(&self, _cx: &mut Cx) -> Result<()>

Releases any resources backing the stream; idempotent by default.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§