Registry / async / tokio-stream

tokio-stream

JSON →
library0.1.18rscratesunverified

Utilities to work with Stream and tokio, including wrappers and combinators.

# Cargo.toml [dependencies] tokio-stream = "0.1.18"
INSTALL
IMPORT
SIG · TOKIO-STREAM
T
tokio-stream
asyncrustv0.1.18
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ReceiverStream
use tokio_stream::wrappers::ReceiverStream;

Demonstrates converting an mpsc receiver into a stream using ReceiverStream.

use tokio::sync::mpsc; use tokio_stream::wrappers::ReceiverStream; use tokio_stream::StreamExt; #[tokio::main] async fn main() { let (tx, rx) = mpsc::channel(32); let mut stream = ReceiverStream::new(rx); tokio::spawn(async move { tx.send(1).await.unwrap(); tx.send(2).await.unwrap(); }); while let Some(value) = stream.next().await { println!("Got: {}", value); } }
Debug
Known issues
gotchaRequires a Tokio runtime to be active.
fix
Use #[tokio::main] or manually create a runtime.
affects: >=0.1.0
Upgrade
Version history
0.1.18latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
29 hits · last 30 days
node
24
OpenAI (training)
1
Resources
tokio-stream — cargo add tokio-stream · libregistry