mod sink_ext;
use std::future::Future;
pub use sink_ext::SinkExt;
#[must_use = "sinks do nothing unless polled"]
pub trait Sink<Item> {
type Error;
fn send(&mut self, item: Item) -> impl Future<Output = Result<(), Self::Error>>;
fn flush(&mut self) -> impl Future<Output = Result<(), Self::Error>>;
fn close(&mut self) -> impl Future<Output = Result<(), Self::Error>>;
}
impl<T, S: ?Sized + Sink<T>> Sink<T> for &mut S {
type Error = S::Error;
fn send(&mut self, item: T) -> impl Future<Output = Result<(), Self::Error>> {
(**self).send(item)
}
fn flush(&mut self) -> impl Future<Output = Result<(), Self::Error>> {
(**self).flush()
}
fn close(&mut self) -> impl Future<Output = Result<(), Self::Error>> {
(**self).close()
}
}