Registry / async / stream-cancel

stream-cancel

JSON →
library0.8.2rscratesunverified

A library for interrupting asynchronous streams.

# Cargo.toml [dependencies] stream-cancel = "0.8.2"
INSTALL
IMPORT
SIG · STREAM-CANCEL
S
stream-cancel
asyncrustv0.8.2
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.

Tripwire
use stream_cancel::Tripwire;

Cancel a stream using a Tripwire.

use stream_cancel::Tripwire; use futures::stream::StreamExt; #[tokio::main] async fn main() { let (trigger, tripwire) = Tripwire::new(); let stream = futures::stream::iter(0..10).take_until(tripwire); drop(trigger); // cancels the stream let result: Vec<_> = stream.collect().await; println!("{:?}", result); }
Debug
Known issues
gotchaRequires an async runtime like Tokio.
fix
Add tokio as a dependency and use #[tokio::main].
affects: >=0.8.0
Upgrade
Version history
0.8.2latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
20 hits · last 30 days
node
18
Resources
stream-cancel — cargo add stream-cancel · libregistry