Skip to main content

ProxyObserver

Trait ProxyObserver 

Source
pub trait ProxyObserver: Send + Sync {
    // Required method
    fn on_event(&self, event: &ProxyEvent);

    // Provided method
    fn wants_events(&self) -> bool { ... }
}
Expand description

Observer that receives events from the proxy’s inline parser.

Implementations must be Send + Sync because the observer is shared across multiple forwarding tasks. Use interior mutability (e.g., Mutex, mpsc::Sender) if you need mutable state.

Required Methods§

Source

fn on_event(&self, event: &ProxyEvent)

Called for each event emitted by the proxy.

Provided Methods§

Source

fn wants_events(&self) -> bool

Whether this observer cares about events.

When this returns false, the proxy can skip constructing ProxyEvent values and, in some cases, skip parsing entirely — turning the proxy into a true byte-for-byte pass-through. Default is true (preserve existing behavior for custom observers).

Implementors§