Skip to main content

tokio_util/util/
mod.rs

1mod maybe_dangling;
2#[cfg(feature = "codec")]
3pub(crate) mod memchr;
4#[cfg(any(feature = "io", feature = "codec"))]
5mod poll_buf;
6
7pub(crate) use maybe_dangling::MaybeDangling;
8#[cfg(any(feature = "io", feature = "codec"))]
9#[cfg_attr(not(feature = "io"), allow(unreachable_pub))]
10pub use poll_buf::{poll_read_buf, poll_write_buf};
11
12cfg_rt! {
13    #[cfg_attr(not(feature = "io"), allow(unused))]
14    pub(crate) use tokio::task::coop::poll_proceed;
15}
16
17cfg_not_rt! {
18    #[cfg_attr(not(feature = "io"), allow(unused))]
19    use std::task::{Context, Poll};
20
21    #[cfg_attr(not(feature = "io"), allow(unused))]
22    pub(crate) struct RestoreOnPending;
23
24    #[cfg_attr(not(feature = "io"), allow(unused))]
25    impl RestoreOnPending {
26        pub(crate) fn made_progress(&self) {}
27    }
28
29    #[cfg_attr(not(feature = "io"), allow(unused))]
30    pub(crate) fn poll_proceed(_cx: &mut Context<'_>) -> Poll<RestoreOnPending> {
31        Poll::Ready(RestoreOnPending)
32    }
33}