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