Apply more review suggestions
This commit is contained in:
parent
f005e1c5d7
commit
e1ec81459d
2 changed files with 11 additions and 3 deletions
|
|
@ -19,7 +19,8 @@ use task::{Poll, Waker};
|
|||
/// final value. This method does not block if the value is not ready. Instead,
|
||||
/// the current task is scheduled to be woken up when it's possible to make
|
||||
/// further progress by `poll`ing again. The wake up is performed using
|
||||
/// `cx.waker()`, a handle for waking up the current task.
|
||||
/// the `waker` argument of the `poll()` method, which is a handle for waking
|
||||
/// up the current task.
|
||||
///
|
||||
/// When using a future, you generally won't call `poll` directly, but instead
|
||||
/// `await!` the value.
|
||||
|
|
@ -78,8 +79,9 @@ pub trait Future {
|
|||
///
|
||||
/// Once a future has completed (returned `Ready` from `poll`),
|
||||
/// then any future calls to `poll` may panic, block forever, or otherwise
|
||||
/// cause bad behavior. The `Future` trait itself provides no guarantees
|
||||
/// about the behavior of `poll` after a future has completed.
|
||||
/// cause any kind of bad behavior expect causing memory unsafety.
|
||||
/// The `Future` trait itself provides no guarantees about the behavior
|
||||
/// of `poll` after a future has completed.
|
||||
///
|
||||
/// [`Poll::Pending`]: ../task/enum.Poll.html#variant.Pending
|
||||
/// [`Poll::Ready(val)`]: ../task/enum.Poll.html#variant.Ready
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@ pub struct RawWakerVTable {
|
|||
|
||||
/// This function will be called when `wake` is called on the [`Waker`].
|
||||
/// It must wake up the task associated with this [`RawWaker`].
|
||||
///
|
||||
/// The implemention of this function must not consume the provided data
|
||||
/// pointer.
|
||||
pub wake: unsafe fn(*const ()),
|
||||
|
||||
/// This function gets called when a [`RawWaker`] gets dropped.
|
||||
|
|
@ -125,7 +128,10 @@ impl Drop for Waker {
|
|||
|
||||
impl fmt::Debug for Waker {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let vtable_ptr = self.waker.vtable as *const RawWakerVTable;
|
||||
f.debug_struct("Waker")
|
||||
.field("data", &self.waker.data)
|
||||
.field("vtable", &vtable_ptr)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue