1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-06-26 20:57:43 +02:00

attribute nits

This commit is contained in:
Rob Ede
2021-01-26 09:45:43 +00:00
parent eaefe21b98
commit cff9deb729
4 changed files with 15 additions and 15 deletions

View File

@ -40,16 +40,16 @@ impl LocalWaker {
since = "2.1.0",
note = "In favor of `wake`. State of the register doesn't matter at `wake` up"
)]
#[inline]
/// Check if waker has been registered.
#[inline]
pub fn is_registered(&self) -> bool {
unsafe { (*self.waker.get()).is_some() }
}
#[inline]
/// Registers the waker to be notified on calls to `wake`.
///
/// Returns `true` if waker was registered before.
#[inline]
pub fn register(&self, waker: &Waker) -> bool {
unsafe {
let w = self.waker.get();
@ -58,20 +58,20 @@ impl LocalWaker {
}
}
#[inline]
/// Calls `wake` on the last `Waker` passed to `register`.
///
/// If `register` has not been called yet, then this does nothing.
#[inline]
pub fn wake(&self) {
if let Some(waker) = self.take() {
waker.wake();
}
}
#[inline]
/// Returns the last `Waker` passed to `register`, so that the user can wake it.
///
/// If a waker has not been registered, this returns `None`.
#[inline]
pub fn take(&self) -> Option<Waker> {
unsafe { (*self.waker.get()).take() }
}