Skip to main content

ProxyCoroutine

Trait ProxyCoroutine 

Source
pub trait ProxyCoroutine {
    type Yield;
    type Return;

    // Required method
    fn resume(
        &mut self,
        arg: Option<&[u8]>,
    ) -> ProxyCoroutineState<Self::Yield, Self::Return>;
}
Available on crate features http or socks5 only.
Expand description

Standard-shape proxy coroutine: owns its internal state, declares a per-step Yield, and returns Result<Output, Error> on completion.

Required Associated Types§

Source

type Yield

The intermediate value emitted on every yielded step.

Source

type Return

The terminal value emitted on completion.

Required Methods§

Source

fn resume( &mut self, arg: Option<&[u8]>, ) -> ProxyCoroutineState<Self::Yield, Self::Return>

Advances one step.

Pass None initially and after every ProxyYield::WantsWrite; pass Some(data) after a ProxyYield::WantsRead(n) with exactly the n bytes that were read.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl ProxyCoroutine for HttpConnect

Available on crate feature http only.
Source§

impl ProxyCoroutine for Socks5Connect

Available on crate feature socks5 only.