Trait netemul::RealmTcpListener
source · pub trait RealmTcpListener: Sized {
// Required method
fn listen_in_realm_with<'a>(
realm: &'a TestRealm<'a>,
addr: SocketAddr,
setup: impl FnOnce(&Socket) -> Result<(), Error> + 'a
) -> LocalBoxFuture<'a, Result<Self, Error>>;
// Provided method
fn listen_in_realm<'a>(
realm: &'a TestRealm<'a>,
addr: SocketAddr
) -> LocalBoxFuture<'a, Result<Self, Error>> { ... }
}
Expand description
Trait describing TCP listeners bound in a testing realm.
Required Methods§
sourcefn listen_in_realm_with<'a>(
realm: &'a TestRealm<'a>,
addr: SocketAddr,
setup: impl FnOnce(&Socket) -> Result<(), Error> + 'a
) -> LocalBoxFuture<'a, Result<Self, Error>>
fn listen_in_realm_with<'a>( realm: &'a TestRealm<'a>, addr: SocketAddr, setup: impl FnOnce(&Socket) -> Result<(), Error> + 'a ) -> LocalBoxFuture<'a, Result<Self, Error>>
Creates a TCP listener by creating a Socket2 socket in realm
. Closure setup
is called
with the reference of the socket before the socket is bound to addr
.
Provided Methods§
sourcefn listen_in_realm<'a>(
realm: &'a TestRealm<'a>,
addr: SocketAddr
) -> LocalBoxFuture<'a, Result<Self, Error>>
fn listen_in_realm<'a>( realm: &'a TestRealm<'a>, addr: SocketAddr ) -> LocalBoxFuture<'a, Result<Self, Error>>
Creates a TCP listener in realm
bound to addr
.
Object Safety§
This trait is not object safe.