pub struct Handle { /* private fields */ }Expand description
A thread-safe handle for submitting work to a Tokio-backed arbiter.
Clones share the same target arbiter; they do not create another runtime.
Implementations§
Source§impl Handle
impl Handle
Sourcepub fn current() -> Handle
pub fn current() -> Handle
Returns a handle to the current arbiter’s runtime.
§Panics
Panics if no arbiter is installed on the current thread. A Tokio runtime context alone is not sufficient.
Sourcepub fn notify(&self)
pub fn notify(&self)
Compatibility hook that does nothing on the Tokio backend.
Task submission and task wakers notify Tokio automatically.
Sourcepub fn busy_duration(&self) -> Option<Duration>
pub fn busy_duration(&self) -> Option<Duration>
Returns the total time the runtime has been busy.
Reports Tokio’s worker_total_busy_duration, which excludes time spent
handling driver events. Returns None if the arbiter does not run on a
current-thread Tokio runtime.
Sourcepub fn current_turn(&self) -> Option<Duration>
pub fn current_turn(&self) -> Option<Duration>
Returns how long the current runtime turn has been running.
Tokio does not expose runtime turns; always returns None.
Sourcepub fn poll_count(&self) -> Option<u64>
pub fn poll_count(&self) -> Option<u64>
Returns the number of runtime polls, not available on Tokio.
Always returns None, the method exists for compatibility with the
other runtime backends.
Sourcepub fn poll_again_count(&self) -> Option<u64>
pub fn poll_again_count(&self) -> Option<u64>
Returns the number of runtime polls that left scheduled tasks, not available on Tokio.
Always returns None, the method exists for compatibility with the
other runtime backends.
Sourcepub fn self_wake_count(&self) -> Option<u64>
pub fn self_wake_count(&self) -> Option<u64>
Returns the number of times a task woke itself while it was polled, not available on Tokio.
Always returns None, the method exists for compatibility with the
native runtime.
Sourcepub fn current_task(&self) -> Option<&'static Location<'static>>
pub fn current_task(&self) -> Option<&'static Location<'static>>
Returns the spawn location of the task the runtime is polling, not available on Tokio.
Always returns None, the method exists for compatibility with the
native runtime.
Sourcepub fn poll_histogram(&self) -> Option<Histogram>
pub fn poll_histogram(&self) -> Option<Histogram>
Returns the histogram of runtime turn durations, not available on Tokio.
Always returns None, the method exists for compatibility with the
other runtime backends.
Sourcepub fn spawn<F>(&self, future: F) -> RemoteJoinHandle<<F as Future>::Output> ⓘ
pub fn spawn<F>(&self, future: F) -> RemoteJoinHandle<<F as Future>::Output> ⓘ
Spawns a task on the handle’s runtime and returns a RemoteJoinHandle.
There is no guarantee that a spawned task will execute to completion.
Both the future and output must be Send, even when submitted on the
runtime thread, which uses the local spawn fast path. Accepted futures
are polled and dropped on the runtime thread, with the output transferred
through the join handle. Rejected submissions are never polled and their
futures may be dropped on the submitting thread.
The returned join handle is neither Send nor Sync; dropping it
detaches the task.
§Panics
Panics on the owner thread if there is no Tokio context supporting local spawning. Submissions from other threads do not require one.
Sourcepub fn spawn_detached<F>(&self, future: F)
pub fn spawn_detached<F>(&self, future: F)
Spawns a new asynchronous task without a join handle.
The output is dropped on the runtime thread when the task completes,
so it does not have to be Send.
The future must be Send, even on the owner thread. Rejected submissions
are never polled and their futures may be dropped on the submitting thread.
§Panics
Panics on the owner thread if there is no Tokio context supporting local spawning. Submissions from other threads do not require one.