1use std::fmt;
2use std::pin::Pin;
3
4use crate::io::{self, Write};
5use crate::task::{Context, Poll};
6
7pub fn sink() -> Sink {
23 Sink { _private: () }
24}
25
26pub struct Sink {
33 _private: (),
34}
35
36impl fmt::Debug for Sink {
37 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
38 f.pad("Sink { .. }")
39 }
40}
41
42impl Write for Sink {
43 #[inline]
44 fn poll_write(
45 self: Pin<&mut Self>,
46 _: &mut Context<'_>,
47 buf: &[u8],
48 ) -> Poll<io::Result<usize>> {
49 Poll::Ready(Ok(buf.len()))
50 }
51
52 #[inline]
53 fn poll_flush(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<io::Result<()>> {
54 Poll::Ready(Ok(()))
55 }
56
57 #[inline]
58 fn poll_close(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<io::Result<()>> {
59 Poll::Ready(Ok(()))
60 }
61}