Struct PeekWaiter
pub struct PeekWaiter<'a> { /* private fields */ }std only.Expand description
Reads peek input, bounded by a scope and classifying the egress
as directed by a PeekPolicy.
Share one waiter across the phases of a single peek. Input that is ready always wins over a cutoff, and the egress is only read while the waiter waits for ingress input.
Implementations§
§impl<'a> PeekWaiter<'a>
impl<'a> PeekWaiter<'a>
pub fn new() -> PeekWaiter<'a>
pub fn new() -> PeekWaiter<'a>
Create a waiter without scope or egress, using PeekPolicy::FAIL_OPEN.
pub fn with_policy(self, policy: PeekPolicy) -> PeekWaiter<'a>
pub fn with_policy(self, policy: PeekPolicy) -> PeekWaiter<'a>
Set the PeekPolicy applied to cutoffs.
pub fn set_policy(&mut self, policy: PeekPolicy) -> &mut PeekWaiter<'a>
pub fn set_policy(&mut self, policy: PeekPolicy) -> &mut PeekWaiter<'a>
Set the PeekPolicy applied to cutoffs.
pub fn maybe_with_scope(self, scope: Option<WeakScope>) -> PeekWaiter<'a>
pub fn maybe_with_scope(self, scope: Option<WeakScope>) -> PeekWaiter<'a>
Set the scope that can cut the peek short, usually the scope
the input runs in, see scope_context.
pub fn maybe_set_scope(
&mut self,
scope: Option<WeakScope>,
) -> &mut PeekWaiter<'a>
pub fn maybe_set_scope( &mut self, scope: Option<WeakScope>, ) -> &mut PeekWaiter<'a>
Set the scope that can cut the peek short, usually the scope
the input runs in, see scope_context.
pub fn with_scope(self, scope: WeakScope) -> PeekWaiter<'a>
pub fn with_scope(self, scope: WeakScope) -> PeekWaiter<'a>
Set the scope that can cut the peek short, usually the scope
the input runs in, see scope_context.
pub fn set_scope(&mut self, scope: WeakScope) -> &mut PeekWaiter<'a>
pub fn set_scope(&mut self, scope: WeakScope) -> &mut PeekWaiter<'a>
Set the scope that can cut the peek short, usually the scope
the input runs in, see scope_context.
pub fn without_scope(self) -> PeekWaiter<'a>
pub fn without_scope(self) -> PeekWaiter<'a>
Set the scope that can cut the peek short, usually the scope
the input runs in, see scope_context.
pub fn unset_scope(&mut self) -> &mut PeekWaiter<'a>
pub fn unset_scope(&mut self) -> &mut PeekWaiter<'a>
Set the scope that can cut the peek short, usually the scope
the input runs in, see scope_context.
pub fn maybe_with_egress(self, egress: Option<PeekEgress<'a>>) -> PeekWaiter<'a>
pub fn maybe_with_egress(self, egress: Option<PeekEgress<'a>>) -> PeekWaiter<'a>
Set the egress side read while the peek waits for ingress input.
pub fn maybe_set_egress(
&mut self,
egress: Option<PeekEgress<'a>>,
) -> &mut PeekWaiter<'a>
pub fn maybe_set_egress( &mut self, egress: Option<PeekEgress<'a>>, ) -> &mut PeekWaiter<'a>
Set the egress side read while the peek waits for ingress input.
pub fn with_egress(self, egress: PeekEgress<'a>) -> PeekWaiter<'a>
pub fn with_egress(self, egress: PeekEgress<'a>) -> PeekWaiter<'a>
Set the egress side read while the peek waits for ingress input.
pub fn set_egress(&mut self, egress: PeekEgress<'a>) -> &mut PeekWaiter<'a>
pub fn set_egress(&mut self, egress: PeekEgress<'a>) -> &mut PeekWaiter<'a>
Set the egress side read while the peek waits for ingress input.
pub fn without_egress(self) -> PeekWaiter<'a>
pub fn without_egress(self) -> PeekWaiter<'a>
Set the egress side read while the peek waits for ingress input.
pub fn unset_egress(&mut self) -> &mut PeekWaiter<'a>
pub fn unset_egress(&mut self) -> &mut PeekWaiter<'a>
Set the egress side read while the peek waits for ingress input.
pub fn finish<E>(self) -> Result<Bytes, E>where
E: From<PeekCutoffError>,
pub fn finish<E>(self) -> Result<Bytes, E>where
E: From<PeekCutoffError>,
End the peek: the error of a cutoff for which the policy selected
PeekAction::Fail, see Self::check, or else the egress bytes
read, to be replayed to the service that follows.
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 ingress bytes this peek holds so far.
pub async fn read_buf<R, B>(
&mut self,
reader: &mut R,
buf: &mut B,
peeked: usize,
) -> PeekRead
pub async fn read_buf<R, B>( &mut self, reader: &mut R, buf: &mut B, peeked: usize, ) -> PeekRead
Read into the spare capacity of buf unless a cutoff stops the peek first.
peeked is the number of ingress bytes this peek holds so far.
pub async fn wait_for<F>(
&mut self,
input: F,
peeked: usize,
) -> Result<<F as Future>::Output, PeekCutoff>where
F: Future,
pub async fn wait_for<F>(
&mut self,
input: F,
peeked: usize,
) -> Result<<F as Future>::Output, PeekCutoff>where
F: Future,
Await input unless a cutoff stops the peek first, for peekers whose
input is not an [AsyncRead].
input wins over a cutoff that is ready at the same time, and the
egress is read while input is pending. peeked is the progress of
the peek so far, 0 meaning idle: a cutoff for which the policy selects
PeekAction::Wait is ignored until that progress changes. After a
cutoff, Self::check returns the error if the policy fails the peek.
pub fn check<E>(&self) -> Result<(), E>where
E: From<PeekCutoffError>,
pub fn check<E>(&self) -> Result<(), E>where
E: From<PeekCutoffError>,
Returns the error of a cutoff for which the policy selected PeekAction::Fail.
Trait Implementations§
§impl<'a> Debug for PeekWaiter<'a>
impl<'a> Debug for PeekWaiter<'a>
§impl<'a> Default for PeekWaiter<'a>
impl<'a> Default for PeekWaiter<'a>
§fn default() -> PeekWaiter<'a>
fn default() -> PeekWaiter<'a>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for PeekWaiter<'a>
impl<'a> !Sync for PeekWaiter<'a>
impl<'a> !UnwindSafe for PeekWaiter<'a>
impl<'a> Forget for PeekWaiter<'a>
impl<'a> Freeze for PeekWaiter<'a>where
*const ArcInner<Node> is !null: Freeze,
PhantomData<ArcInner<Node>>: Freeze,
*const ArcInner<Composite> is !null: Freeze,
PhantomData<ArcInner<Composite>>: Freeze,
&'a mut (dyn AsyncRead + Send + Unpin): Freeze,
&'a dyn PeekEgressPredicate: Freeze,
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
impl<'a> Move for PeekWaiter<'a>
impl<'a> Send for PeekWaiter<'a>
impl<'a> Unpin for PeekWaiter<'a>
impl<'a> UnsafeUnpin for PeekWaiter<'a>where
*const ArcInner<Node> is !null: UnsafeUnpin,
PhantomData<ArcInner<Node>>: UnsafeUnpin,
*const ArcInner<Composite> is !null: UnsafeUnpin,
PhantomData<ArcInner<Composite>>: UnsafeUnpin,
&'a mut (dyn AsyncRead + Send + Unpin): UnsafeUnpin,
&'a dyn PeekEgressPredicate: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
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