pub struct InputBuffer<T> { /* private fields */ }embedded_runtime only.Expand description
An address-stable FIFO queue that backs a [futures::Stream] input parameter of a
generated embedded function.
The queue is filled from application code via push and drained by the
dataflow graph through an InputStream created with stream. The
stream never terminates: while the queue is empty it returns Poll::Pending, and it
is woken by the next push.
Implementations§
Source§impl<T> InputBuffer<T>
impl<T> InputBuffer<T>
Sourcepub fn push(&self, item: T)
pub fn push(&self, item: T)
Pushes an item onto the queue and wakes the InputStream if it is waiting.
Note that the item is only queued; it is processed the next time the flow runs.
Sourcepub unsafe fn stream(self: Pin<&Self>) -> InputStream<T>
pub unsafe fn stream(self: Pin<&Self>) -> InputStream<T>
Creates a never-terminating [futures::Stream] that drains this buffer, for
passing to a generated embedded function.
Multiple streams over one buffer are allowed (though rarely useful): items are delivered to whichever stream polls first, and only the most recent waker is woken.
§Safety
The buffer must outlive the returned stream. (The buffer cannot move while the
stream exists, which is guaranteed by self being pinned, and the stream cannot be
sent to another thread, as it is !Send.)
Trait Implementations§
Source§impl<T> Debug for InputBuffer<T>
impl<T> Debug for InputBuffer<T>
Auto Trait Implementations§
impl<T> !Freeze for InputBuffer<T>
impl<T> !RefUnwindSafe for InputBuffer<T>
impl<T> !Send for InputBuffer<T>
impl<T> !Sync for InputBuffer<T>
impl<T> !Unpin for InputBuffer<T>
impl<T> !UnsafeUnpin for InputBuffer<T>
impl<T> UnwindSafe for InputBuffer<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more