Struct tor_rtmock::MockNetRuntime [−][src]
pub struct MockNetRuntime<R: Runtime> { /* fields omitted */ }
Expand description
A wrapper Runtime that overrides the SleepProvider trait for the underlying runtime.
Implementations
Create a new runtime that wraps runtime
, but overrides
its view of the network with a MockNetProvider
, net
.
Return a reference to the MockNetProvider
Trait Implementations
type SleepFuture = R::SleepFuture
type SleepFuture = R::SleepFuture
A future returned by SleepProvider::sleep()
Return a future that will be ready after duration
has
elapsed. Read more
Return the SleepProvider’s view of the current wall-clock time. Read more
Signify that a test running under mock time shouldn’t advance time yet, with a given unique reason string. This is useful for making sure (mock) time doesn’t advance while things that might require some (real-world) time to complete do so, such as spawning a task on another thread. Read more
Signify that the reason to withhold time advancing provided in a call to block_advance
no
longer exists, and it’s fine to move time forward if nothing else is blocking advances. Read more
Allow a test running under mock time to advance time by the provided duration, even if the
above block_advance
API has been used. Read more
type TcpStream = <MockNetProvider as TcpProvider>::TcpStream
type TcpStream = <MockNetProvider as TcpProvider>::TcpStream
The type for the TCP connections returned by Self::connect()
.
type TcpListener = <MockNetProvider as TcpProvider>::TcpListener
type TcpListener = <MockNetProvider as TcpProvider>::TcpListener
The type for the TCP listeners returned by Self::listen()
.
Launch a TCP connection to a given socket address. Read more
fn listen<'life0, 'life1, 'async_trait>(
&'life0 self,
addr: &'life1 SocketAddr
) -> Pin<Box<dyn Future<Output = IoResult<Self::TcpListener>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn listen<'life0, 'life1, 'async_trait>(
&'life0 self,
addr: &'life1 SocketAddr
) -> Pin<Box<dyn Future<Output = IoResult<Self::TcpListener>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Open a TCP listener on a given socket address.
type Connector = <MockNetProvider as TlsProvider>::Connector
type Connector = <MockNetProvider as TlsProvider>::Connector
The Connector object that this provider can return.
type TlsStream = <MockNetProvider as TlsProvider>::TlsStream
type TlsStream = <MockNetProvider as TlsProvider>::TlsStream
The type of the stream returned by that connector.
Return a TLS connector for use with this runtime.
Auto Trait Implementations
impl<R> RefUnwindSafe for MockNetRuntime<R> where
R: RefUnwindSafe,
impl<R> Send for MockNetRuntime<R>
impl<R> Sync for MockNetRuntime<R>
impl<R> Unpin for MockNetRuntime<R> where
R: Unpin,
impl<R> UnwindSafe for MockNetRuntime<R> where
R: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Pause until the wall-clock is at when
or later, trying to
recover from clock jumps. Read more
impl<Sp> SpawnExt for Sp where
Sp: Spawn + ?Sized,
impl<Sp> SpawnExt for Sp where
Sp: Spawn + ?Sized,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more