Skip to main content

ExecutorHandle

Struct ExecutorHandle 

Source
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,

Source

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,

Source

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.

Source

pub fn now(&self) -> Instant

Current monotonic time in this backend’s clock domain.

Source

pub fn resolve(&self, request: DnsRequest) -> Resolve<B> ⓘ

Resolve through WASI ip-name-lookup or the native blocking pool. Web returns Unsupported.

Source

pub fn blocking<F>(&self, work: F) -> Blocking<B> ⓘ
where F: FnOnce() -> Result<Payload, Error> + Send + 'static,

Run owned work on the shared bounded blocking pool. Cancellation discards its result; an already running closure retains all its owned data.

Source

pub fn close(&self, handle: Handle) -> Close<B> ⓘ

Close a resource and await physical release after its terminal I/O results.

Source

pub fn connect(&self, addr: SocketAddr, opts: TcpOpts) -> Connect<B> ⓘ

Connect TCP without blocking the host. Dropping closes the pending socket.

Source

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.

Source

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.

Source

pub fn io(&self, handle: Handle) -> AsyncIo<B>

Adopt a loop-owned TCP/local/stdio stream. Drop cancels I/O and closes it.

Source

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.

Source

pub fn sleep_until(&self, deadline: Instant) -> Sleep<B> ⓘ

Sleep until an absolute deadline in the backend clock domain.

Source

pub fn sleep(&self, duration: Duration) -> Sleep<B> ⓘ

Sleep for a duration starting now.

Source

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.

Source

pub fn accept(&self, listener: Handle) -> Accept<B> ⓘ

Await an incoming TCP or local connection.

Source

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,

Source§

fn clone(&self) -> ExecutorHandle<B>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<B> !RefUnwindSafe for ExecutorHandle<B>

§

impl<B> !Send for ExecutorHandle<B>

§

impl<B> !Sync for ExecutorHandle<B>

§

impl<B> !UnwindSafe for ExecutorHandle<B>

§

impl<B> Forget for ExecutorHandle<B>

§

impl<B> Freeze for ExecutorHandle<B>
where Rc<Shared<B>>: Freeze,

§

impl<B> Unpin for ExecutorHandle<B>
where Rc<Shared<B>>: Unpin,

§

impl<B> UnsafeUnpin for ExecutorHandle<B>
where Rc<Shared<B>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.