[−][src]Struct async_wormhole::AsyncWormhole
AsyncWormhole captures a stack and a closure. It also implements Future and can be awaited on.
Implementations
impl<'a, Stack: Stack, Output> AsyncWormhole<'a, Stack, Output, (), 0>
[src]
pub fn new<F>(stack: Stack, f: F) -> Result<Self, Error> where
F: FnOnce(AsyncYielder<'_, Output>) -> Output + 'a,
[src]
F: FnOnce(AsyncYielder<'_, Output>) -> Output + 'a,
Returns a new AsyncWormhole, using the passed stack
to execute the closure f
on.
The closure will not be executed right away, only if you pass AsyncWormhole to an
async executor (.await on it).
impl<'a, Stack: Stack, Output, TLS, const TLS_COUNT: usize> AsyncWormhole<'a, Stack, Output, TLS, TLS_COUNT>
[src]
pub fn new_with_tls<F>(
tls_refs: [&'static LocalKey<Cell<*const TLS>>; TLS_COUNT],
stack: Stack,
f: F
) -> Result<Self, Error> where
F: FnOnce(AsyncYielder<'_, Output>) -> Output + 'a,
[src]
tls_refs: [&'static LocalKey<Cell<*const TLS>>; TLS_COUNT],
stack: Stack,
f: F
) -> Result<Self, Error> where
F: FnOnce(AsyncYielder<'_, Output>) -> Output + 'a,
Similar to new
, but allows you to capture thread local variables inside the closure.
During the execution of the future an async executor can move the closure f
between
threads. From the perspective of the code inside the closure f
the thread local
variables will be moving with it from thread to thread.
Safety
If the thread local variable is only set and used inside of the f
closure than it's safe
to use it. Outside of the closure the content of it will be unpredictable.
pub fn stack(self) -> Stack
[src]
Get the stack from the internal generator.
Trait Implementations
impl<'a, Stack: Stack + Unpin, Output, TLS: Unpin, const TLS_COUNT: usize> Future for AsyncWormhole<'a, Stack, Output, TLS, TLS_COUNT>
[src]
type Output = Option<Output>
The type of value produced on completion.
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>
[src]
impl<Stack: Stack, Output, TLS, const TLS_COUNT: usize, '_> Send for AsyncWormhole<'_, Stack, Output, TLS, TLS_COUNT>
[src]
Auto Trait Implementations
impl<'a, Stack, Output, TLS, const TLS_COUNT: usize> !RefUnwindSafe for AsyncWormhole<'a, Stack, Output, TLS, TLS_COUNT>
impl<'a, Stack, Output, TLS, const TLS_COUNT: usize> !Sync for AsyncWormhole<'a, Stack, Output, TLS, TLS_COUNT>
impl<'a, Stack, Output, TLS, const TLS_COUNT: usize> Unpin for AsyncWormhole<'a, Stack, Output, TLS, TLS_COUNT> where
Stack: Unpin,
Stack: Unpin,
impl<'a, Stack, Output, TLS, const TLS_COUNT: usize> UnwindSafe for AsyncWormhole<'a, Stack, Output, TLS, TLS_COUNT> where
Output: RefUnwindSafe,
Stack: UnwindSafe,
TLS: RefUnwindSafe,
Output: RefUnwindSafe,
Stack: UnwindSafe,
TLS: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<F> IntoFuture for F where
F: Future,
[src]
F: Future,
type Output = <F as Future>::Output
into_future
)The output that the future will produce on completion.
type Future = F
into_future
)Which kind of future are we turning this into?
fn into_future(self) -> <F as IntoFuture>::Future
[src]
impl<T> Pointable for T
const ALIGN: usize
type Init = T
The type for initializers.
unsafe fn init(init: <T as Pointable>::Init) -> usize
unsafe fn deref<'a>(ptr: usize) -> &'a T
unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
unsafe fn drop(ptr: usize)
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,