Expand description
Async wrapper around crate::Stream using the C-level
ove_stream_set_notify notify hook.
The pattern is the canonical “embassy primitive on top of an RTOS synchronous primitive”:
- The wrapper owns an
AtomicWaker. - On construction it registers a C callback against the underlying
stream; the callback is
AtomicWaker::wakevia a void* user_data. recv_asyncpolls the non-blockingStream::try_recvfirst, and onWouldBlockregisterscx.waker()into the AtomicWaker, then re-checks (avoids lost-wake races against the producer).
Lifetime constraint: the C callback retains a pointer to the
AtomicWaker, so the AsyncStream’s address must be stable for its
entire lifetime. The simplest pattern is a static declaration or
Box::leak. Methods take &'static self to enforce this at the
type level.
Structs§
- Async
Stream - Async wrapper around an
ove::Stream.