Trait tor_rtcompat::Runtime
source ·
[−]pub trait Runtime: Sync + Send + Spawn + SpawnBlocking + Clone + SleepProvider + TcpProvider + TlsProvider<Self::TcpStream> + 'static { }
Expand description
A runtime that we can use to run Tor as a client.
This trait comprises several other traits that we require all of our runtimes to provide:
- [
futures::task::Spawn
] to launch new background tasks. SleepProvider
to pause a task for a given amount of time.TcpProvider
to launch and accept TCP connections.TlsProvider
to launch TLS connections.SpawnBlocking
to block on a future and run it to completion (This may become optional in the future, if/when we add WASM support).
We require that every Runtime
has an efficient Clone
implementation
that gives a new opaque reference to the same underlying runtime.
Additionally, every Runtime
is Send
and Sync
, though these
requirements may be somewhat relaxed in the future.