Trait PeekEgressPredicate
pub trait PeekEgressPredicate: Send + Sync {
// Required methods
fn egress(&self, bytes: &[u8]) -> PeekVerdict<()>;
fn peeks_egress(&self) -> bool;
}std only.Expand description
Judges the bytes the egress (server) side sent while a peek waits for the client.
| Verdict | Meaning | Effect |
|---|---|---|
Match | definitively the server side of this protocol | keep waiting for the client; stop reading egress |
NeedMore | a valid prefix of it so far | keep waiting; read more egress |
Reject | cannot be this protocol, whatever follows | PeekCutoff::EgressMismatch |
Implementations must be prefix-closed (once Reject or Match, always the
same for any extension) and only Reject bytes a standard client of the
protocol refuses as the start of the server’s side; when unsure, NeedMore.
Reaching the egress size limit while NeedMore keeps waiting.
A Match keeps the peek waiting for the client, so a server-first
protocol whose opening matches waits until the client speaks or the
scope the input runs in ends: bound that scope where this matters.
Once settled the egress is not read again, so a server closing after a
matching opening is seen by the service that follows the verdict.
Closures Fn(&[u8]) -> PeekVerdict<()> implement it and peek the egress.
Required Methods§
fn egress(&self, bytes: &[u8]) -> PeekVerdict<()>
fn egress(&self, bytes: &[u8]) -> PeekVerdict<()>
Judge the egress bytes received so far, never empty.
fn peeks_egress(&self) -> bool
fn peeks_egress(&self) -> bool
Whether the egress is read at all.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".