Trait futures_util::task::UnsafeFutureObj [−][src]
A custom implementation of a future trait object for FutureObj
, providing
a vtable with drop support.
This custom representation is typically used only in no_std
contexts,
where the default Box
-based implementation is not available.
Safety
See the safety notes on individual methods for what guarantees an implementor must provide.
Required methods
pub fn into_raw(self) -> *mut dyn Future<Output = T> + 'a
[src]
Convert an owned instance into a (conceptually owned) fat pointer.
Safety
Implementor
The trait implementor must guarantee that it is safe to convert the
provided *mut (dyn Future<Output = T> + 'a)
into a Pin<&mut (dyn Future<Output = T> + 'a)>
and call methods on it, non-reentrantly,
until UnsafeFutureObj::drop
is called with it.
pub unsafe fn drop(ptr: *mut dyn Future<Output = T> + 'a)
[src]
Drops the future represented by the given fat pointer.
Safety
Implementor
The trait implementor must guarantee that it is safe to call this
function once per into_raw
invocation.
Caller
The caller must ensure:
- the pointer passed was obtained from an
into_raw
invocation from this same trait object - the pointer is not currently in use as a
Pin<&mut (dyn Future<Output = T> + 'a)>
- the pointer must not be used again after this function is called
Implementations on Foreign Types
impl<'a, T> UnsafeFutureObj<'a, T> for Box<dyn Future<Output = T> + 'a + Send, Global> where
T: 'a,
[src]
T: 'a,
pub fn into_raw(self) -> *mut dyn Future<Output = T> + 'a
[src]
pub unsafe fn drop(ptr: *mut dyn Future<Output = T> + 'a)
[src]
impl<'a, T> UnsafeFutureObj<'a, T> for Pin<Box<dyn Future<Output = T> + 'a, Global>> where
T: 'a,
[src]
T: 'a,
pub fn into_raw(self) -> *mut dyn Future<Output = T> + 'a
[src]
pub unsafe fn drop(ptr: *mut dyn Future<Output = T> + 'a)
[src]
impl<'a, T> UnsafeFutureObj<'a, T> for Pin<Box<dyn Future<Output = T> + 'a + Send, Global>> where
T: 'a,
[src]
T: 'a,
pub fn into_raw(self) -> *mut dyn Future<Output = T> + 'a
[src]
pub unsafe fn drop(ptr: *mut dyn Future<Output = T> + 'a)
[src]
impl<'a, T, F> UnsafeFutureObj<'a, T> for Pin<&'a mut F> where
F: Future<Output = T> + 'a,
[src]
F: Future<Output = T> + 'a,
pub fn into_raw(self) -> *mut dyn Future<Output = T> + 'a
[src]
pub unsafe fn drop(_ptr: *mut dyn Future<Output = T> + 'a)
[src]
impl<'a, T> UnsafeFutureObj<'a, T> for Box<dyn Future<Output = T> + 'a, Global> where
T: 'a,
[src]
T: 'a,
pub fn into_raw(self) -> *mut dyn Future<Output = T> + 'a
[src]
pub unsafe fn drop(ptr: *mut dyn Future<Output = T> + 'a)
[src]
impl<'a, T> UnsafeFutureObj<'a, T> for Pin<&'a mut (dyn Future<Output = T> + 'a)>
[src]
pub fn into_raw(self) -> *mut dyn Future<Output = T> + 'a
[src]
pub unsafe fn drop(_ptr: *mut dyn Future<Output = T> + 'a)
[src]
impl<'a, T, F> UnsafeFutureObj<'a, T> for Box<F, Global> where
F: Future<Output = T> + 'a,
[src]
F: Future<Output = T> + 'a,
pub fn into_raw(self) -> *mut dyn Future<Output = T> + 'a
[src]
pub unsafe fn drop(ptr: *mut dyn Future<Output = T> + 'a)
[src]
impl<'a, T, F> UnsafeFutureObj<'a, T> for Pin<Box<F, Global>> where
F: Future<Output = T> + 'a,
[src]
F: Future<Output = T> + 'a,
pub fn into_raw(self) -> *mut dyn Future<Output = T> + 'a
[src]
pub unsafe fn drop(ptr: *mut dyn Future<Output = T> + 'a)
[src]
impl<'a, T> UnsafeFutureObj<'a, T> for &'a mut (dyn Future<Output = T> + 'a + Unpin)
[src]
pub fn into_raw(self) -> *mut dyn Future<Output = T> + 'a
[src]
pub unsafe fn drop(_ptr: *mut dyn Future<Output = T> + 'a)
[src]
Implementors
impl<'a, T, F> UnsafeFutureObj<'a, T> for &'a mut F where
F: Future<Output = T> + Unpin + 'a,
[src]
F: Future<Output = T> + Unpin + 'a,