diff options
author | Oleg Nosov <olegnosov1@gmail.com> | 2020-01-24 20:31:13 +0300 |
---|---|---|
committer | Carl Lerche <me@carllerche.com> | 2020-01-24 09:31:13 -0800 |
commit | f9ddb93604a830d106475bd4c4cae436fafcc0da (patch) | |
tree | 6f200680e68b290794ef0512dcb031ef6d81c5ea /tokio-test | |
parent | a70f7203a46d471345128832987017612d8e4585 (diff) |
docs: use third form in API docs (#2027)
Diffstat (limited to 'tokio-test')
-rw-r--r-- | tokio-test/src/macros.rs | 10 | ||||
-rw-r--r-- | tokio-test/src/task.rs | 13 |
2 files changed, 11 insertions, 12 deletions
diff --git a/tokio-test/src/macros.rs b/tokio-test/src/macros.rs index dbe2280f..299bd775 100644 --- a/tokio-test/src/macros.rs +++ b/tokio-test/src/macros.rs @@ -1,6 +1,6 @@ //! A collection of useful macros for testing futures and tokio based code -/// Assert a `Poll` is ready, returning the value. +/// Asserts a `Poll` is ready, returning the value. /// /// This will invoke `panic!` if the provided `Poll` does not evaluate to `Poll::Ready` at /// runtime. @@ -39,7 +39,7 @@ macro_rules! assert_ready { }}; } -/// Assert a `Poll<Result<...>>` is ready and `Ok`, returning the value. +/// Asserts a `Poll<Result<...>>` is ready and `Ok`, returning the value. /// /// This will invoke `panic!` if the provided `Poll` does not evaluate to `Poll::Ready(Ok(..))` at /// runtime. @@ -72,7 +72,7 @@ macro_rules! assert_ready_ok { }}; } -/// Assert a `Poll<Result<...>>` is ready and `Err`, returning the error. +/// Asserts a `Poll<Result<...>>` is ready and `Err`, returning the error. /// /// This will invoke `panic!` if the provided `Poll` does not evaluate to `Poll::Ready(Err(..))` at /// runtime. @@ -105,7 +105,7 @@ macro_rules! assert_ready_err { }}; } -/// Assert a `Poll` is pending. +/// Asserts a `Poll` is pending. /// /// This will invoke `panic!` if the provided `Poll` does not evaluate to `Poll::Pending` at /// runtime. @@ -144,7 +144,7 @@ macro_rules! assert_pending { }}; } -/// Assert if a poll is ready and check for equality on the value +/// Asserts if a poll is ready and check for equality on the value /// /// This will invoke `panic!` if the provided `Poll` does not evaluate to `Poll::Ready` at /// runtime and the value produced does not partially equal the expected value. diff --git a/tokio-test/src/task.rs b/tokio-test/src/task.rs index 71ebe7b4..04328e3d 100644 --- a/tokio-test/src/task.rs +++ b/tokio-test/src/task.rs @@ -45,7 +45,7 @@ const WAKE: usize = 1; const SLEEP: usize = 2; impl<T> Spawn<T> { - /// Consume `self` returning the inner value + /// Consumes `self` returning the inner value pub fn into_inner(mut self) -> T where T: Unpin, @@ -101,7 +101,7 @@ impl<T: Unpin> ops::DerefMut for Spawn<T> { } impl<T: Future> Spawn<T> { - /// Poll a future + /// Polls a future pub fn poll(&mut self) -> Poll<T::Output> { let fut = self.future.as_mut(); self.task.enter(|cx| fut.poll(cx)) @@ -109,7 +109,7 @@ impl<T: Future> Spawn<T> { } impl<T: Stream> Spawn<T> { - /// Poll a stream + /// Polls a stream pub fn poll_next(&mut self) -> Poll<Option<T::Item>> { let stream = self.future.as_mut(); self.task.enter(|cx| stream.poll_next(cx)) @@ -117,14 +117,14 @@ impl<T: Stream> Spawn<T> { } impl MockTask { - /// Create a new mock task + /// Creates new mock task fn new() -> Self { MockTask { waker: Arc::new(ThreadWaker::new()), } } - /// Run a closure from the context of the task. + /// Runs a closure from the context of the task. /// /// Any wake notifications resulting from the execution of the closure are /// tracked. @@ -190,8 +190,7 @@ impl ThreadWaker { } fn wake(&self) { - // First, try transitioning from IDLE -> NOTIFY, this does not require a - // lock. + // First, try transitioning from IDLE -> NOTIFY, this does not require a lock. let mut state = self.state.lock().unwrap(); let prev = *state; |