| @@ -8,17 +8,17 @@ use http::header::HeaderValue; | ||||
| use httpdate::HttpDate; | ||||
|  | ||||
| // "Sun, 06 Nov 1994 08:49:37 GMT".len() | ||||
| pub const DATE_VALUE_LENGTH: usize = 29; | ||||
| pub(crate) const DATE_VALUE_LENGTH: usize = 29; | ||||
|  | ||||
| #[cfg(feature = "http1")] | ||||
| pub fn extend(dst: &mut Vec<u8>) { | ||||
| pub(crate) fn extend(dst: &mut Vec<u8>) { | ||||
|     CACHED.with(|cache| { | ||||
|         dst.extend_from_slice(cache.borrow().buffer()); | ||||
|     }) | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "http1")] | ||||
| pub fn update() { | ||||
| pub(crate) fn update() { | ||||
|     CACHED.with(|cache| { | ||||
|         cache.borrow_mut().check(); | ||||
|     }) | ||||
|   | ||||
| @@ -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>), | ||||
|   | ||||
| @@ -24,7 +24,7 @@ pub trait NewSvcExec<I, N, S: HttpService<Body>, E, W: Watcher<I, S, E>>: Clone | ||||
|     fn execute_new_svc(&mut self, fut: NewSvcTask<I, N, S, E, W>); | ||||
| } | ||||
|  | ||||
| pub type BoxSendFuture = Pin<Box<dyn Future<Output = ()> + Send>>; | ||||
| pub(crate) type BoxSendFuture = Pin<Box<dyn Future<Output = ()> + Send>>; | ||||
|  | ||||
| // Either the user provides an executor for background tasks, or we use | ||||
| // `tokio::spawn`. | ||||
|   | ||||
| @@ -29,7 +29,13 @@ pub(crate) mod watch; | ||||
| #[cfg(any(feature = "http1", feature = "http2"))] | ||||
| #[cfg(feature = "client")] | ||||
| pub(crate) use self::lazy::{lazy, Started as Lazy}; | ||||
| pub use self::never::Never; | ||||
| #[cfg(any( | ||||
|     feature = "client", | ||||
|     feature = "http1", | ||||
|     feature = "http2", | ||||
|     feature = "runtime" | ||||
| ))] | ||||
| pub(crate) use self::never::Never; | ||||
| pub(crate) use self::task::Poll; | ||||
|  | ||||
| // group up types normally needed for `Future` | ||||
|   | ||||
| @@ -6,7 +6,7 @@ use std::error::Error; | ||||
| use std::fmt; | ||||
|  | ||||
| #[derive(Debug)] | ||||
| pub enum Never {} | ||||
| pub(crate) enum Never {} | ||||
|  | ||||
| impl fmt::Display for Never { | ||||
|     fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result { | ||||
|   | ||||
| @@ -46,7 +46,7 @@ | ||||
| /// [`poll`]: https://doc.rust-lang.org/std/future/trait.Future.html#method.poll | ||||
| /// [`Sync`]: https://doc.rust-lang.org/std/marker/trait.Sync.html | ||||
| #[repr(transparent)] | ||||
| pub struct SyncWrapper<T>(T); | ||||
| pub(crate) struct SyncWrapper<T>(T); | ||||
|  | ||||
| impl<T> SyncWrapper<T> { | ||||
|     /// Creates a new SyncWrapper containing the given value. | ||||
| @@ -58,7 +58,7 @@ impl<T> SyncWrapper<T> { | ||||
|     /// | ||||
|     /// let wrapped = SyncWrapper::new(42); | ||||
|     /// ``` | ||||
|     pub fn new(value: T) -> Self { | ||||
|     pub(crate) fn new(value: T) -> Self { | ||||
|         Self(value) | ||||
|     } | ||||
|  | ||||
| @@ -82,7 +82,7 @@ impl<T> SyncWrapper<T> { | ||||
|     /// *value = 0; | ||||
|     /// assert_eq!(*wrapped.get_mut(), 0); | ||||
|     /// ``` | ||||
|     pub fn get_mut(&mut self) -> &mut T { | ||||
|     pub(crate) fn get_mut(&mut self) -> &mut T { | ||||
|         &mut self.0 | ||||
|     } | ||||
|  | ||||
| @@ -105,7 +105,7 @@ impl<T> SyncWrapper<T> { | ||||
|     /// assert_eq!(wrapped.into_inner(), 42); | ||||
|     /// ``` | ||||
|     #[allow(dead_code)] | ||||
|     pub fn into_inner(self) -> T { | ||||
|     pub(crate) fn into_inner(self) -> T { | ||||
|         self.0 | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user