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");
}
Upgrade
Version history
0.3.31latest on crates.io
Audit
Dependencies
No dependency data recorded yet.