pub trait RealmTcpStream: Sized {
    // Required methods
    fn connect_in_realm<'a>(
        realm: &'a TestRealm<'a>,
        addr: SocketAddr
    ) -> LocalBoxFuture<'a, Result<Self, Error>>;
    fn bind_and_connect_in_realm<'a>(
        realm: &'a TestRealm<'a>,
        local: SocketAddr,
        dst: SocketAddr
    ) -> LocalBoxFuture<'a, Result<Self, Error>>;
    fn connect_in_realm_with_sock<'a, F: FnOnce(&Socket) -> Result<(), Error> + 'a>(
        realm: &'a TestRealm<'a>,
        dst: SocketAddr,
        with_sock: F
    ) -> LocalBoxFuture<'a, Result<Self, Error>>;
}
Expand description

Trait describing TCP streams in a testing realm.

Required Methods§

source

fn connect_in_realm<'a>( realm: &'a TestRealm<'a>, addr: SocketAddr ) -> LocalBoxFuture<'a, Result<Self, Error>>

Creates a TCP stream in realm connected to addr.

source

fn bind_and_connect_in_realm<'a>( realm: &'a TestRealm<'a>, local: SocketAddr, dst: SocketAddr ) -> LocalBoxFuture<'a, Result<Self, Error>>

Creates a TCP stream in realm bound to local and connected to dst.

source

fn connect_in_realm_with_sock<'a, F: FnOnce(&Socket) -> Result<(), Error> + 'a>( realm: &'a TestRealm<'a>, dst: SocketAddr, with_sock: F ) -> LocalBoxFuture<'a, Result<Self, Error>>

Creates a TCP stream in realm connected to addr.

Closure with_sock is called with the reference of the socket before the socket is connected to addr.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl RealmTcpStream for TcpStream

source§

fn connect_in_realm<'a>( realm: &'a TestRealm<'a>, addr: SocketAddr ) -> LocalBoxFuture<'a, Result<Self, Error>>

source§

fn bind_and_connect_in_realm<'a>( realm: &'a TestRealm<'a>, local: SocketAddr, dst: SocketAddr ) -> LocalBoxFuture<'a, Result<Self, Error>>

source§

fn connect_in_realm_with_sock<'a, F: FnOnce(&Socket) -> Result<(), Error> + 'a>( realm: &'a TestRealm<'a>, dst: SocketAddr, with_sock: F ) -> LocalBoxFuture<'a, Result<TcpStream, Error>>

Implementors§