netemul

Trait RealmTcpStream

Source
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.

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.

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§