Skip to main content

PeekIoProvider

Trait PeekIoProvider 

pub trait PeekIoProvider: Send + 'static {
    type PeekIo: Io;
    type Mapped<PeekedIo: Io>: Send + 'static;

    // Required methods
    fn peek_io_mut(&mut self) -> &mut Self::PeekIo;
    fn map_peek_io<PeekedIo, F>(self, map: F) -> Self::Mapped<PeekedIo>
       where PeekedIo: Io,
             F: FnOnce(Self::PeekIo) -> PeekedIo;
}
Expand description

A higher level trait that can be used by services which wish to peek into I/O, often as part of Deep Protocol Inspections (DPI).

It is implemented for any Io, returning itself. BridgeIo also implements it, assuming that the first element is the ingress side that is ok to be peeked.

Required Associated Types§

type PeekIo: Io

The type that can be peeked.

type Mapped<PeekedIo: Io>: Send + 'static

The mapped Self type produced as a result of mapping the PeekIo type.

Required Methods§

fn peek_io_mut(&mut self) -> &mut Self::PeekIo

Retrieve a mutable reference to the Peekable type.

fn map_peek_io<PeekedIo, F>(self, map: F) -> Self::Mapped<PeekedIo>
where PeekedIo: Io, F: FnOnce(Self::PeekIo) -> PeekedIo,

Once peeking is finished one can reproduce self by mapping the Peeked Io type and produce a new type, usually with the peeked data in-memory as prefix.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

§

impl<Ingress, Egress> PeekIoProvider for BridgeIo<Ingress, Egress>
where Ingress: Io, Egress: Io,

§

type PeekIo = Ingress

§

type Mapped<PeekedIngress: Io> = BridgeIo<PeekedIngress, Egress>

§

impl<T> PeekIoProvider for T
where T: Io,

§

type PeekIo = T

§

type Mapped<PeekedIo: Io> = PeekedIo