readd doc comment

This commit is contained in:
fakeshadow 2021-01-26 03:17:51 -08:00
parent 106c307d85
commit 45a841e8c7
1 changed files with 5 additions and 0 deletions

View File

@ -27,6 +27,8 @@ pub struct ClientResponse<S = PayloadStream> {
pub(crate) timeout: ResponseTimeout, pub(crate) timeout: ResponseTimeout,
} }
/// helper enum with reusable sleep passed from `SendClientResponse`.
/// See `ClientResponse::_timeout` for reason.
pub(crate) enum ResponseTimeout { pub(crate) enum ResponseTimeout {
Disabled(Option<Pin<Box<Sleep>>>), Disabled(Option<Pin<Box<Sleep>>>),
Enabled(Option<Pin<Box<Sleep>>>), Enabled(Option<Pin<Box<Sleep>>>),
@ -175,6 +177,9 @@ impl<S> ClientResponse<S> {
} }
} }
/// This method does not enable timeout. It's used to pass the boxed `Sleep` from
/// `SendClientRequest` and reuse it's heap allocation together with it's slot in
/// timer wheel.
pub(crate) fn _timeout(mut self, timeout: Option<Pin<Box<Sleep>>>) -> Self { pub(crate) fn _timeout(mut self, timeout: Option<Pin<Box<Sleep>>>) -> Self {
self.timeout = ResponseTimeout::Disabled(timeout); self.timeout = ResponseTimeout::Disabled(timeout);
self self