refactor(lib): apply unreachable_pub lint (#2400)

Closes #2390
This commit is contained in:
Taiki Endo
2021-01-15 02:57:55 +09:00
committed by GitHub
parent a15f3f7f0f
commit f0ddb66932
28 changed files with 196 additions and 185 deletions

View File

@@ -5,19 +5,19 @@ use tokio::sync::watch;
use super::{task, Future, Pin, Poll};
pub fn channel() -> (Signal, Watch) {
pub(crate) fn channel() -> (Signal, Watch) {
let (tx, rx) = watch::channel(());
(Signal { tx }, Watch { rx })
}
pub struct Signal {
pub(crate) struct Signal {
tx: watch::Sender<()>,
}
pub struct Draining(Pin<Box<dyn Future<Output = ()> + Send + Sync>>);
pub(crate) struct Draining(Pin<Box<dyn Future<Output = ()> + Send + Sync>>);
#[derive(Clone)]
pub struct Watch {
pub(crate) struct Watch {
rx: watch::Receiver<()>,
}
@@ -37,7 +37,7 @@ enum State<F> {
}
impl Signal {
pub fn drain(self) -> Draining {
pub(crate) fn drain(self) -> Draining {
let _ = self.tx.send(());
Draining(Box::pin(async move { self.tx.closed().await }))
}
@@ -52,7 +52,7 @@ impl Future for Draining {
}
impl Watch {
pub fn watch<F, FN>(self, future: F, on_drain: FN) -> Watching<F, FN>
pub(crate) fn watch<F, FN>(self, future: F, on_drain: FN) -> Watching<F, FN>
where
F: Future,
FN: FnOnce(Pin<&mut F>),