MCPcopy Index your code
hub / github.com/async-rs/stop-token

github.com/async-rs/stop-token @v0.2.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.2.0 ↗ · + Follow
11 symbols 16 edges 2 files 4 documented · 36%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Cooperative cancellation for async-std.

Status: experimental.

See crate docs for details

use stop_token::StopToken;

async fn do_work(work: impl Stream<Item = Event>, stop_token: StopToken) {
    // The `work` stream will end early: as soon as `stop_token` is cancelled. 
    let mut work = stop_token.stop_stream(work);
    while let Some(event) = work.next().await {
        process_event(event).await
    }
}

Core symbols most depended-on inside this repo

stop_token
called by 1
src/lib.rs
poll
called by 1
src/lib.rs
stop_stream
called by 1
src/lib.rs
default
called by 0
src/lib.rs
new
called by 0
src/lib.rs
stop_future
called by 0
src/lib.rs
poll_next
called by 0
src/lib.rs

Shape

Method 7
Class 2
Enum 1
Function 1

Languages

Rust100%

Modules by API surface

src/lib.rs10 symbols
tests/tests.rs1 symbols

For agents

$ claude mcp add stop-token \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact