pub struct Notified<'a> { /* private fields */ }Expand description
The future Notify::notified returns.
It is fused: once it completes, polling it again is ready at once.
Dropping it after a notify_one or notify_last reached it, but before
it completed, passes that notification to the next waiter.
Implementations§
Source§impl Notified<'_>
impl Notified<'_>
Sourcepub fn enable(self: Pin<&mut Self>) -> bool
pub fn enable(self: Pin<&mut Self>) -> bool
Adds this future to the waiters that receive notify_one and
notify_last, as its first poll would, without registering a waker.
Polling does the same; this is for a caller that must be queued
before it checks a condition, so a notification sent in between is
not stored as a permit for someone else.
notify_waiters is received from creation on, enabled or not.
Returns true if the future is ready, which any later poll then reports at once. That is so when:
notify_waiterswas called since the future was created;- this is the first
enableor poll and theNotifyheld a permit, which the call consumes; or - the future was enabled or polled before and has since been notified.
use nuclei::sync::Notify;
use std::pin::pin;
let notify = Notify::new();
let mut waiting = pin!(notify.notified());
assert!(!waiting.as_mut().enable(), "nothing was sent yet");
notify.notify_one();
assert!(waiting.as_mut().enable(), "the one sent after enable is its");Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Notified<'a>
impl<'a> !UnwindSafe for Notified<'a>
impl<'a> Freeze for Notified<'a>
impl<'a> Send for Notified<'a>
impl<'a> Sync for Notified<'a>
impl<'a> Unpin for Notified<'a>
impl<'a> UnsafeUnpin for Notified<'a>
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
Mutably borrows from an owned value. Read more
Source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
Source§type IntoFuture = F
type IntoFuture = F
Which kind of future are we turning this into?
Source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read more