Registry / async / futures-sink

futures-sink

JSON →
library0.3.31rscratesunverified

The asynchronous `Sink` trait for the futures-rs library.

# Cargo.toml [dependencies] futures-sink = "0.3.31"
INSTALL
IMPORT
SIG · FUTURES-SINK
F
futures-sink
asyncrustv0.3.31
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.

Sink
use futures_sink::Sink;

Implements the `Sink` trait for a custom type.

use futures_sink::Sink; use std::pin::Pin; use std::task::{Context, Poll}; struct MySink; impl Sink<i32> for MySink { type Error = std::io::Error; fn poll_ready(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> { Poll::Ready(Ok(())) } fn start_send(self: Pin<&mut Self>, _item: i32) -> Result<(), Self::Error> { Ok(()) } fn poll_flush(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> { Poll::Ready(Ok(())) } fn poll_close(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> { Poll::Ready(Ok(())) } } fn main() { let sink = MySink; println!("Sink trait implemented"); }
Debug
Known issues
gotchaRequires an async runtime (e.g., tokio) to use with async code.
fix
Add `tokio` or `async-std` as a dependency and use an executor.
affects: >=0.3.0
Upgrade
Version history
0.3.31latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
26 hits · last 30 days
node
22
OpenAI (training)
1
Resources
futures-sink — cargo add futures-sink · libregistry