Trait UnsafeFutureObj
unsafe trait UnsafeFutureObj<'a, T>: 'a
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
fn into_raw(self: Self) -> *mut dyn Future<Output = T> + 'aConvert 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 aPin<&mut (dyn Future<Output = T> + 'a)>and call methods on it, non-reentrantly, untilUnsafeFutureObj::dropis called with it.unsafe fn drop(ptr: *mut dyn Future<Output = T> + 'a)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_rawinvocation.Caller
The caller must ensure:
- the pointer passed was obtained from an
into_rawinvocation 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
- the pointer passed was obtained from an
Implementors
impl<'a, T, F> UnsafeFutureObj for &'a mut Fimpl<'a, T> UnsafeFutureObj for &'a mut dyn Future<Output = T> + Unpin + 'aimpl<'a, T, F> UnsafeFutureObj for Pin<&'a mut F>impl<'a, T> UnsafeFutureObj for Pin<&'a mut dyn Future<Output = T> + 'a>impl<'a, T, F> UnsafeFutureObj for Box<F>impl<'a, T: 'a> UnsafeFutureObj for Box<dyn Future<Output = T> + 'a>impl<'a, T: 'a> UnsafeFutureObj for Box<dyn Future<Output = T> + Send + 'a>impl<'a, T, F> UnsafeFutureObj for Pin<Box<F>>impl<'a, T: 'a> UnsafeFutureObj for Pin<Box<dyn Future<Output = T> + 'a>>impl<'a, T: 'a> UnsafeFutureObj for Pin<Box<dyn Future<Output = T> + Send + 'a>>