Struct PeekPolicy
pub struct PeekPolicy { /* private fields */ }std only.Expand description
Decides what a PeekCutoff does, given the PeekProgress of the peek.
Distinguishing idle from partial input separates two cases a single timeout cannot: a peer that never speaks first (e.g. a server-first protocol) versus a peer that started a protocol message and is slow to complete it.
Definitive verdicts (match, reject, EOF, size limits) are not affected.
Implementations§
§impl PeekPolicy
impl PeekPolicy
pub const FAIL_OPEN: PeekPolicy
pub const FAIL_OPEN: PeekPolicy
Timeouts invoke the fallback.
An interrupt invokes the fallback for idle input and is ignored for partial input. This is the default.
pub const FAIL_CLOSED: PeekPolicy
pub const FAIL_CLOSED: PeekPolicy
Timeouts fail the peek.
Interrupts behave as in Self::FAIL_OPEN.
pub const fn action(
&self,
cutoff: PeekCutoff,
progress: PeekProgress,
) -> PeekAction
pub const fn action( &self, cutoff: PeekCutoff, progress: PeekProgress, ) -> PeekAction
The PeekAction for cutoff at progress.
pub const fn with_timeout_idle(self, action: PeekAction) -> PeekPolicy
pub const fn with_timeout_idle(self, action: PeekAction) -> PeekPolicy
Set the action for a timeout before any byte was peeked.
pub fn set_timeout_idle(&mut self, action: PeekAction) -> &mut PeekPolicy
pub fn set_timeout_idle(&mut self, action: PeekAction) -> &mut PeekPolicy
Set the action for a timeout before any byte was peeked.
pub const fn with_timeout_partial(self, action: PeekAction) -> PeekPolicy
pub const fn with_timeout_partial(self, action: PeekAction) -> PeekPolicy
Set the action for a timeout after a partial peek.
pub fn set_timeout_partial(&mut self, action: PeekAction) -> &mut PeekPolicy
pub fn set_timeout_partial(&mut self, action: PeekAction) -> &mut PeekPolicy
Set the action for a timeout after a partial peek.
pub const fn with_interrupt_idle(self, action: PeekAction) -> PeekPolicy
pub const fn with_interrupt_idle(self, action: PeekAction) -> PeekPolicy
Set the action for an interrupt before any byte was peeked.
pub fn set_interrupt_idle(&mut self, action: PeekAction) -> &mut PeekPolicy
pub fn set_interrupt_idle(&mut self, action: PeekAction) -> &mut PeekPolicy
Set the action for an interrupt before any byte was peeked.
pub const fn with_interrupt_partial(self, action: PeekAction) -> PeekPolicy
pub const fn with_interrupt_partial(self, action: PeekAction) -> PeekPolicy
Set the action for an interrupt after a partial peek.
pub fn set_interrupt_partial(&mut self, action: PeekAction) -> &mut PeekPolicy
pub fn set_interrupt_partial(&mut self, action: PeekAction) -> &mut PeekPolicy
Set the action for an interrupt after a partial peek.
Trait Implementations§
§impl Clone for PeekPolicy
impl Clone for PeekPolicy
§fn clone(&self) -> PeekPolicy
fn clone(&self) -> PeekPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for PeekPolicy
§impl Debug for PeekPolicy
impl Debug for PeekPolicy
§impl Default for PeekPolicy
impl Default for PeekPolicy
§fn default() -> PeekPolicy
fn default() -> PeekPolicy
impl Eq for PeekPolicy
§impl PartialEq for PeekPolicy
impl PartialEq for PeekPolicy
§impl<Input> PeekPolicyProvider<Input> for PeekPolicy
impl<Input> PeekPolicyProvider<Input> for PeekPolicy
§fn peek_policy(&self, _input: &Input) -> PeekPolicy
fn peek_policy(&self, _input: &Input) -> PeekPolicy
PeekPolicy to apply while peeking input.impl StructuralPartialEq for PeekPolicy
Auto Trait Implementations§
impl Forget for PeekPolicy
impl Freeze for PeekPolicy
impl RefUnwindSafe for PeekPolicy
impl Send for PeekPolicy
impl Sync for PeekPolicy
impl Unpin for PeekPolicy
impl UnsafeUnpin for PeekPolicy
impl UnwindSafe for PeekPolicy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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