Struct PeekWaiter
pub struct PeekWaiter { /* private fields */ }std only.Expand description
Reads peek input, bounded by a timeout and a PeekInterrupt
as directed by a PeekPolicy.
The timeout starts when the waiter is created and covers all reads made through it, so share one waiter across the phases of a single peek. Input that is ready always wins over a cutoff.
Implementations§
§impl PeekWaiter
impl PeekWaiter
pub fn new(timeout: Option<Duration>) -> PeekWaiter
pub fn new(timeout: Option<Duration>) -> PeekWaiter
Create a waiter whose optional timeout starts now.
pub fn with_policy(self, policy: PeekPolicy) -> PeekWaiter
pub fn with_policy(self, policy: PeekPolicy) -> PeekWaiter
Set the PeekPolicy applied to cutoffs.
pub fn set_policy(&mut self, policy: PeekPolicy) -> &mut PeekWaiter
pub fn set_policy(&mut self, policy: PeekPolicy) -> &mut PeekWaiter
Set the PeekPolicy applied to cutoffs.
pub fn maybe_with_interrupt(
self,
interrupt: Option<Arc<PeekInterrupt>>,
) -> PeekWaiter
pub fn maybe_with_interrupt( self, interrupt: Option<Arc<PeekInterrupt>>, ) -> PeekWaiter
Set the PeekInterrupt that can cut the peek short,
usually the one found in the input extensions.
pub fn maybe_set_interrupt(
&mut self,
interrupt: Option<Arc<PeekInterrupt>>,
) -> &mut PeekWaiter
pub fn maybe_set_interrupt( &mut self, interrupt: Option<Arc<PeekInterrupt>>, ) -> &mut PeekWaiter
Set the PeekInterrupt that can cut the peek short,
usually the one found in the input extensions.
pub fn with_interrupt(self, interrupt: Arc<PeekInterrupt>) -> PeekWaiter
pub fn with_interrupt(self, interrupt: Arc<PeekInterrupt>) -> PeekWaiter
Set the PeekInterrupt that can cut the peek short,
usually the one found in the input extensions.
pub fn set_interrupt(
&mut self,
interrupt: Arc<PeekInterrupt>,
) -> &mut PeekWaiter
pub fn set_interrupt( &mut self, interrupt: Arc<PeekInterrupt>, ) -> &mut PeekWaiter
Set the PeekInterrupt that can cut the peek short,
usually the one found in the input extensions.
pub fn without_interrupt(self) -> PeekWaiter
pub fn without_interrupt(self) -> PeekWaiter
Set the PeekInterrupt that can cut the peek short,
usually the one found in the input extensions.
pub fn unset_interrupt(&mut self) -> &mut PeekWaiter
pub fn unset_interrupt(&mut self) -> &mut PeekWaiter
Set the PeekInterrupt that can cut the peek short,
usually the one found in the input extensions.
pub async fn read<R>(
&mut self,
reader: &mut R,
buf: &mut [u8],
peeked: usize,
) -> PeekRead
pub async fn read<R>( &mut self, reader: &mut R, buf: &mut [u8], peeked: usize, ) -> PeekRead
Read into buf unless a cutoff stops the peek first.
peeked is the number of bytes this peek holds so far.
pub fn check<E>(&self) -> Result<(), E>
pub fn check<E>(&self) -> Result<(), E>
Returns the error of a cutoff for which the policy selected PeekAction::Fail.
Trait Implementations§
§impl Debug for PeekWaiter
impl Debug for PeekWaiter
§impl Default for PeekWaiter
impl Default for PeekWaiter
§fn default() -> PeekWaiter
fn default() -> PeekWaiter
Auto Trait Implementations§
impl !RefUnwindSafe for PeekWaiter
impl !UnwindSafe for PeekWaiter
impl Forget for PeekWaiter
impl Freeze for PeekWaiter
impl Move for PeekWaiter
impl Send for PeekWaiter
impl Sync for PeekWaiter
impl Unpin for PeekWaiter
impl UnsafeUnpin for PeekWaiter
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more