pub struct TokioRuntimeHandle {
owned: Option<TokioTp>,
handle: Handle,
}
native-tls
or rustls
) and (crate features async-std
or tokio
) and crate feature tokio
only.Expand description
Wrapper around a Handle to a tokio runtime.
Ideally, this type would go away, and we would just use
tokio::runtime::Handle
directly. Unfortunately, we can’t implement
futures::Spawn
on it ourselves because of Rust’s orphan rules, so we need
to define a new type here.
§Limitations
Note that Arti requires that the runtime should have working implementations for Tokio’s time, net, and io facilities, but we have no good way to check that when creating this object.
Fields§
§owned: Option<TokioTp>
If present, the tokio executor that we’ve created (and which we own).
We never access this directly; only through handle
. We keep it here
so that our Runtime types can be agnostic about whether they own the
executor.
handle: Handle
The underlying Handle.
Implementations§
Source§impl TokioRuntimeHandle
impl TokioRuntimeHandle
Sourcepub(crate) fn new(handle: Handle) -> Self
pub(crate) fn new(handle: Handle) -> Self
Wrap a tokio runtime handle into a format that Arti can use.
§Limitations
Note that Arti requires that the runtime should have working implementations for Tokio’s time, net, and io facilities, but we have no good way to check that when creating this object.
Trait Implementations§
Source§impl Blocking for TokioRuntimeHandle
impl Blocking for TokioRuntimeHandle
Source§type ThreadHandle<T: Send + 'static> = BlockingHandle<T>
type ThreadHandle<T: Send + 'static> = BlockingHandle<T>
spawn_blocking
Source§fn spawn_blocking<F, T>(&self, f: F) -> BlockingHandle<T>
fn spawn_blocking<F, T>(&self, f: F) -> BlockingHandle<T>
Source§impl Clone for TokioRuntimeHandle
impl Clone for TokioRuntimeHandle
Source§fn clone(&self) -> TokioRuntimeHandle
fn clone(&self) -> TokioRuntimeHandle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for TokioRuntimeHandle
impl Debug for TokioRuntimeHandle
Source§impl From<Handle> for TokioRuntimeHandle
impl From<Handle> for TokioRuntimeHandle
Source§impl From<TokioTp> for TokioRuntimeHandle
impl From<TokioTp> for TokioRuntimeHandle
Source§fn from(owner: TokioTp) -> TokioRuntimeHandle
fn from(owner: TokioTp) -> TokioRuntimeHandle
Source§impl NetStreamProvider<SocketAddr> for TokioRuntimeHandle
impl NetStreamProvider<SocketAddr> for TokioRuntimeHandle
Source§type Stream = UnixStream
type Stream = UnixStream
Self::connect()
.Source§type Listener = UnixListener
type Listener = UnixListener
Self::listen()
.Source§fn connect<'life0, 'life1, 'async_trait>(
&'life0 self,
addr: &'life1 SocketAddr,
) -> Pin<Box<dyn Future<Output = IoResult<Self::Stream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn connect<'life0, 'life1, 'async_trait>(
&'life0 self,
addr: &'life1 SocketAddr,
) -> Pin<Box<dyn Future<Output = IoResult<Self::Stream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl NetStreamProvider for TokioRuntimeHandle
impl NetStreamProvider for TokioRuntimeHandle
Source§type Stream = TcpStream
type Stream = TcpStream
Self::connect()
.Source§type Listener = TcpListener
type Listener = TcpListener
Self::listen()
.Source§fn connect<'life0, 'life1, 'async_trait>(
&'life0 self,
addr: &'life1 SocketAddr,
) -> Pin<Box<dyn Future<Output = IoResult<Self::Stream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn connect<'life0, 'life1, 'async_trait>(
&'life0 self,
addr: &'life1 SocketAddr,
) -> Pin<Box<dyn Future<Output = IoResult<Self::Stream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl SleepProvider for TokioRuntimeHandle
impl SleepProvider for TokioRuntimeHandle
Source§type SleepFuture = Sleep
type SleepFuture = Sleep
SleepProvider::sleep()
Source§fn sleep(&self, duration: Duration) -> Self::SleepFuture
fn sleep(&self, duration: Duration) -> Self::SleepFuture
duration
has
elapsed.Source§fn wallclock(&self) -> SystemTime
fn wallclock(&self) -> SystemTime
Source§fn block_advance<T: Into<String>>(&self, _reason: T)
fn block_advance<T: Into<String>>(&self, _reason: T)
Source§fn release_advance<T: Into<String>>(&self, _reason: T)
fn release_advance<T: Into<String>>(&self, _reason: T)
block_advance
no
longer exists, and it’s fine to move time forward if nothing else is blocking advances. Read moreSource§fn allow_one_advance(&self, _dur: Duration)
fn allow_one_advance(&self, _dur: Duration)
block_advance
API has been used. Read moreSource§impl Spawn for TokioRuntimeHandle
impl Spawn for TokioRuntimeHandle
Source§impl ToplevelBlockOn for TokioRuntimeHandle
impl ToplevelBlockOn for TokioRuntimeHandle
Source§impl UdpProvider for TokioRuntimeHandle
impl UdpProvider for TokioRuntimeHandle
Source§type UdpSocket = UdpSocket
type UdpSocket = UdpSocket
Self::bind()
Auto Trait Implementations§
impl Freeze for TokioRuntimeHandle
impl !RefUnwindSafe for TokioRuntimeHandle
impl Send for TokioRuntimeHandle
impl Sync for TokioRuntimeHandle
impl Unpin for TokioRuntimeHandle
impl !UnwindSafe for TokioRuntimeHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> NetStreamProvider<SocketAddr> for T
impl<T> NetStreamProvider<SocketAddr> for T
Source§type Stream = Stream
type Stream = Stream
Self::connect()
.Source§type Listener = Listener
type Listener = Listener
Self::listen()
.Source§fn connect<'life0, 'life1, 'async_trait>(
&'life0 self,
addr: &'life1 SocketAddr,
) -> Pin<Box<dyn Future<Output = Result<Stream, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
fn connect<'life0, 'life1, 'async_trait>(
&'life0 self,
addr: &'life1 SocketAddr,
) -> Pin<Box<dyn Future<Output = Result<Stream, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
Source§impl<T> SleepProviderExt for Twhere
T: SleepProvider,
impl<T> SleepProviderExt for Twhere
T: SleepProvider,
Source§fn timeout<F: Future>(
&self,
duration: Duration,
future: F,
) -> Timeout<F, Self::SleepFuture> ⓘ
fn timeout<F: Future>( &self, duration: Duration, future: F, ) -> Timeout<F, Self::SleepFuture> ⓘ
Source§fn sleep_until_wallclock(
&self,
when: SystemTime,
) -> SleepUntilWallclock<'_, Self> ⓘ
fn sleep_until_wallclock( &self, when: SystemTime, ) -> SleepUntilWallclock<'_, Self> ⓘ
when
or later, trying to
recover from clock jumps. Read more§impl<Sp> SpawnExt for Spwhere
Sp: Spawn + ?Sized,
impl<Sp> SpawnExt for Spwhere
Sp: Spawn + ?Sized,
§fn spawn<Fut>(&self, future: Fut) -> Result<(), SpawnError>
fn spawn<Fut>(&self, future: Fut) -> Result<(), SpawnError>
()
to
completion. Read more