Skip to main content

LegacyHook

Struct LegacyHook 

Source
pub struct LegacyHook(pub Arc<dyn LegacyProxyHook>);
Expand description

Adapts a LegacyProxyHook to ProxyHook, preserving 0.3.x semantics exactly.

Three behaviours are preserved deliberately:

  • Self::interest yields DATAGRAMS, plus CONTROL only when the wrapped hook’s wants_control_mutation() is true. DATAGRAMS is unconditional because the 0.3.x datagram hook was the datagram hook, and dropping the flag would stop datagram rewriting for anyone who had it.
  • A control Some(bytes) returned by a hook whose wants_control_mutation() is false is discarded, as it was in 0.3.x. Mapping it to Action::Replace unconditionally would make an observe-only hook that returns Some(..) out of sloppiness start rewriting production traffic — source-compatible, compiling, and semantically inverted.
  • on_datagram returns Action::Pass when the header did not decode, because 0.3.x never called the hook in that case.

One behaviour changes, and it is a change rather than a fix: in 0.3.x on_datagram was unreachable unless an observer was attached. It now fires regardless.

Tuple Fields§

§0: Arc<dyn LegacyProxyHook>

Trait Implementations§

Source§

impl ProxyHook for LegacyHook

Source§

fn interest(&self) -> Interest

What this hook wants the proxy to parse. Read more
Source§

fn on_control_message( &self, cx: &FrameCtx<'_>, msg: &AnyControlMessage, raw: &[u8], ) -> Action

Called before forwarding a control message. Read more
Source§

fn on_datagram( &self, cx: &FrameCtx<'_>, header: Option<&AnyDatagramHeader>, raw: &[u8], ) -> Action

Called before forwarding a datagram. Read more
Source§

fn on_stream_open(&self, _cx: &StreamCtx<'_>) -> StreamAction

Called after a unidirectional stream is accepted and before the peer stream is opened. Stream identity only — see StreamCtx. Read more
Source§

fn on_stream_header( &self, _cx: &StreamCtx<'_>, _header: &DataStreamHeaderKind, ) -> StreamAction

Called once the data stream’s header has been framed and before its bytes are forwarded. Read more
Source§

fn on_object(&self, _cx: &ObjectCtx<'_>, _raw: &[u8]) -> Action

Called before forwarding one complete object. Read more
Source§

fn on_stream_end(&self, _cx: &StreamCtx<'_>, _end: StreamEnd) -> Action

Called when a forwarded stream ends, for any reason. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more