Trait alloc::task::UnsafeTask [−][src]
pub unsafe trait UnsafeTask: 'static + Send { fn into_raw(self) -> *mut (); unsafe fn poll(task: *mut (), cx: &mut Context) -> Poll<()>; unsafe fn drop(task: *mut ()); }
🔬 This is a nightly-only experimental API. (futures_api
#50547)
futures in libcore are unstable
A custom implementation of a task trait object for TaskObj
, providing
a hand-rolled vtable.
This custom representation is typically used only in no_std
contexts,
where the default Box
-based implementation is not available.
The implementor must guarantee that it is safe to call poll
repeatedly (in
a non-concurrent fashion) with the result of into_raw
until drop
is
called.
Required Methods
fn into_raw(self) -> *mut ()
🔬 This is a nightly-only experimental API. (futures_api
#50547)
futures in libcore are unstable
Convert a owned instance into a (conceptually owned) void pointer.
unsafe fn poll(task: *mut (), cx: &mut Context) -> Poll<()>
🔬 This is a nightly-only experimental API. (futures_api
#50547)
futures in libcore are unstable
Poll the task represented by the given void pointer.
Safety
The trait implementor must guarantee that it is safe to repeatedly call
poll
with the result of into_raw
until drop
is called; such calls
are not, however, allowed to race with each other or with calls to drop
.
unsafe fn drop(task: *mut ())
🔬 This is a nightly-only experimental API. (futures_api
#50547)
futures in libcore are unstable
Drops the task represented by the given void pointer.
Safety
The trait implementor must guarantee that it is safe to call this
function once per into_raw
invocation; that call cannot race with
other calls to drop
or poll
.