pub struct ExecutorHandle<B>where
B: Backend,{ /* private fields */ }Expand description
Cloneable local access to executor resource wrappers and task spawning.
Implementations§
Source§impl<B> ExecutorHandle<B>where
B: Backend,
impl<B> ExecutorHandle<B>where
B: Backend,
Sourcepub fn datagram(&self, handle: Handle) -> AsyncDatagram<B>
pub fn datagram(&self, handle: Handle) -> AsyncDatagram<B>
Adopt an existing loop-owned UDP socket. Do not give the same handle to another adapter or close it through the driver while this owner is live.
Source§impl<B> ExecutorHandle<B>where
B: Backend,
impl<B> ExecutorHandle<B>where
B: Backend,
Sourcepub fn driver(&self) -> RefMut<'_, Driver<B>>
pub fn driver(&self) -> RefMut<'_, Driver<B>>
Borrow the driver for resource configuration. Release before awaiting.
Tokens with the top bit set belong to the executor; completions for any
other token are handed back to the host by LocalExecutor::turn_into.
Sourcepub fn resolve(&self, request: DnsRequest) -> Resolve<B> ⓘ
pub fn resolve(&self, request: DnsRequest) -> Resolve<B> ⓘ
Resolve through WASI ip-name-lookup or the native blocking pool. Web returns Unsupported.
Sourcepub fn blocking<F>(&self, work: F) -> Blocking<B> ⓘ
pub fn blocking<F>(&self, work: F) -> Blocking<B> ⓘ
Run owned work on the shared bounded blocking pool. Cancellation discards its result; an already running closure retains all its owned data.
Sourcepub fn close(&self, handle: Handle) -> Close<B> ⓘ
pub fn close(&self, handle: Handle) -> Close<B> ⓘ
Close a resource and await physical release after its terminal I/O results.
Sourcepub fn connect(&self, addr: SocketAddr, opts: TcpOpts) -> Connect<B> ⓘ
pub fn connect(&self, addr: SocketAddr, opts: TcpOpts) -> Connect<B> ⓘ
Connect TCP without blocking the host. Dropping closes the pending socket.
Sourcepub fn connect_bound(
&self,
transport: <B as Backend>::Detached,
addr: SocketAddr,
opts: TcpOpts,
) -> Connect<B> ⓘ
pub fn connect_bound( &self, transport: <B as Backend>::Detached, addr: SocketAddr, opts: TcpOpts, ) -> Connect<B> ⓘ
Connect an already-bound native TCP transport without replacing its
socket, local endpoint or pre-handshake options. Dropping the future
before polling drops the transport; dropping a pending attempt closes
it through the driver. See Driver::tcp_connect_bound_with_options.
Sourcepub fn timeout_at<F>(&self, deadline: Instant, future: F) -> Timeout<B, F> ⓘwhere
F: Future,
pub fn timeout_at<F>(&self, deadline: Instant, future: F) -> Timeout<B, F> ⓘwhere
F: Future,
Apply an absolute deadline without resetting it between I/O operations.
Sourcepub fn io(&self, handle: Handle) -> AsyncIo<B>
pub fn io(&self, handle: Handle) -> AsyncIo<B>
Adopt a loop-owned TCP/local/stdio stream. Drop cancels I/O and closes it.
Sourcepub fn udp(&self, handle: Handle, peer: SocketAddr) -> AsyncIo<B>
pub fn udp(&self, handle: Handle, peer: SocketAddr) -> AsyncIo<B>
Adopt a UDP socket. AsyncWrite sends one datagram to peer; AsyncRead
receives one datagram and discards its source address. Large writes are
rejected rather than split into several datagrams.
Sourcepub fn sleep_until(&self, deadline: Instant) -> Sleep<B> ⓘ
pub fn sleep_until(&self, deadline: Instant) -> Sleep<B> ⓘ
Sleep until an absolute deadline in the backend clock domain.
Sourcepub fn timeout<F>(&self, duration: Duration, future: F) -> Timeout<B, F> ⓘwhere
F: Future,
pub fn timeout<F>(&self, duration: Duration, future: F) -> Timeout<B, F> ⓘwhere
F: Future,
Fail with TimedOut if the future does not finish before the duration.
Sourcepub fn accept(&self, listener: Handle) -> Accept<B> ⓘ
pub fn accept(&self, listener: Handle) -> Accept<B> ⓘ
Await an incoming TCP or local connection.
Sourcepub fn spawn_local<F>(
&self,
future: F,
) -> Result<JoinHandle<<F as Future>::Output>, Error>where
F: Future + 'static,
pub fn spawn_local<F>(
&self,
future: F,
) -> Result<JoinHandle<<F as Future>::Output>, Error>where
F: Future + 'static,
Spawn a !Send future with a cancellation-on-drop join handle.
Trait Implementations§
Source§impl<B> Clone for ExecutorHandle<B>where
B: Backend,
impl<B> Clone for ExecutorHandle<B>where
B: Backend,
Source§fn clone(&self) -> ExecutorHandle<B>
fn clone(&self) -> ExecutorHandle<B>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more