pub enum PendingDownstreamReqTask {
Complete(Result<Option<NextRequest>, Error>),
Waiting(Receiver<NextRequest>, Instant),
}Expand description
This is very similar to a PeekableTask task, but is intentionally set up so that it has no spawned tokio tasks separating us from the oneshot::Sender and detecting when it’s dropped.
The try_recv() method can be used to make sure that we safely recover
any pending requests that are sent to us without dropping them.
Variants§
Implementations§
Source§impl PendingDownstreamReqTask
impl PendingDownstreamReqTask
pub fn new( rx: Option<Receiver<NextRequest>>, timeout: Duration, ) -> PendingDownstreamReqTask
Sourcepub async fn recv(self) -> Result<Option<DownstreamRequest>, Error>
pub async fn recv(self) -> Result<Option<DownstreamRequest>, Error>
Receive a downstream request.
This will block until the sender side of the channel is either dropped or sends us a value.
Sourcepub async fn await_ready(&mut self)
pub async fn await_ready(&mut self)
Drive this task to completion.
If we have passed the deadline for the task, we try to recover any request in the channel. If there is none, then the timed out task will resolve to [Error::NoDownstreamReqsAvailable].
§Cancel Safety
Note that this method is used with FutureExt::now_or_never in AsyncItem::is_ready, and should therefore be kept cancel safe.
Trait Implementations§
Source§impl Debug for PendingDownstreamReqTask
impl Debug for PendingDownstreamReqTask
Source§impl From<PendingDownstreamReqTask> for AsyncItem
impl From<PendingDownstreamReqTask> for AsyncItem
Source§fn from(task: PendingDownstreamReqTask) -> Self
fn from(task: PendingDownstreamReqTask) -> Self
Auto Trait Implementations§
impl !Freeze for PendingDownstreamReqTask
impl !RefUnwindSafe for PendingDownstreamReqTask
impl Send for PendingDownstreamReqTask
impl Sync for PendingDownstreamReqTask
impl Unpin for PendingDownstreamReqTask
impl !UnwindSafe for PendingDownstreamReqTask
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
self file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more