mirror of
https://github.com/fafhrd91/actix-net
synced 2024-11-23 22:51:07 +01:00
doc nits
This commit is contained in:
parent
81a2b6a425
commit
841c611233
@ -12,7 +12,6 @@ repository = "https://github.com/actix/actix-net.git"
|
|||||||
documentation = "https://docs.rs/actix-server"
|
documentation = "https://docs.rs/actix-server"
|
||||||
categories = ["network-programming", "asynchronous"]
|
categories = ["network-programming", "asynchronous"]
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
exclude = [".gitignore", ".cargo/config"]
|
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
@ -8,7 +8,7 @@ use mio::{Registry, Token as MioToken, Waker};
|
|||||||
|
|
||||||
use crate::worker::WorkerHandle;
|
use crate::worker::WorkerHandle;
|
||||||
|
|
||||||
/// waker token for `mio::Poll` instance
|
/// Waker token for `mio::Poll` instance.
|
||||||
pub(crate) const WAKER_TOKEN: MioToken = MioToken(usize::MAX);
|
pub(crate) const WAKER_TOKEN: MioToken = MioToken(usize::MAX);
|
||||||
|
|
||||||
/// `mio::Waker` with a queue for waking up the `Accept`'s `Poll` and contains the `WakerInterest`
|
/// `mio::Waker` with a queue for waking up the `Accept`'s `Poll` and contains the `WakerInterest`
|
||||||
@ -30,7 +30,7 @@ impl Deref for WakerQueue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl WakerQueue {
|
impl WakerQueue {
|
||||||
/// construct a waker queue with given `Poll`'s `Registry` and capacity.
|
/// Construct a waker queue with given `Poll`'s `Registry` and capacity.
|
||||||
///
|
///
|
||||||
/// A fixed `WAKER_TOKEN` is used to identify the wake interest and the `Poll` needs to match
|
/// A fixed `WAKER_TOKEN` is used to identify the wake interest and the `Poll` needs to match
|
||||||
/// event's token for it to properly handle `WakerInterest`.
|
/// event's token for it to properly handle `WakerInterest`.
|
||||||
@ -41,7 +41,7 @@ impl WakerQueue {
|
|||||||
Ok(Self(Arc::new((waker, queue))))
|
Ok(Self(Arc::new((waker, queue))))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// push a new interest to the queue and wake up the accept poll afterwards.
|
/// Push a new interest to the queue and wake up the accept poll afterwards.
|
||||||
pub(crate) fn wake(&self, interest: WakerInterest) {
|
pub(crate) fn wake(&self, interest: WakerInterest) {
|
||||||
let (waker, queue) = self.deref();
|
let (waker, queue) = self.deref();
|
||||||
|
|
||||||
@ -55,20 +55,20 @@ impl WakerQueue {
|
|||||||
.unwrap_or_else(|e| panic!("can not wake up Accept Poll: {}", e));
|
.unwrap_or_else(|e| panic!("can not wake up Accept Poll: {}", e));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// get a MutexGuard of the waker queue.
|
/// Get a MutexGuard of the waker queue.
|
||||||
pub(crate) fn guard(&self) -> MutexGuard<'_, VecDeque<WakerInterest>> {
|
pub(crate) fn guard(&self) -> MutexGuard<'_, VecDeque<WakerInterest>> {
|
||||||
self.deref().1.lock().expect("Failed to lock WakerQueue")
|
self.deref().1.lock().expect("Failed to lock WakerQueue")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// reset the waker queue so it does not grow infinitely.
|
/// Reset the waker queue so it does not grow infinitely.
|
||||||
pub(crate) fn reset(queue: &mut VecDeque<WakerInterest>) {
|
pub(crate) fn reset(queue: &mut VecDeque<WakerInterest>) {
|
||||||
std::mem::swap(&mut VecDeque::<WakerInterest>::with_capacity(16), queue);
|
std::mem::swap(&mut VecDeque::<WakerInterest>::with_capacity(16), queue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// types of interests we would look into when `Accept`'s `Poll` is waked up by waker.
|
/// Types of interests we would look into when `Accept`'s `Poll` is waked up by waker.
|
||||||
///
|
///
|
||||||
/// *. These interests should not be confused with `mio::Interest` and mostly not I/O related
|
/// These interests should not be confused with `mio::Interest` and mostly not I/O related
|
||||||
pub(crate) enum WakerInterest {
|
pub(crate) enum WakerInterest {
|
||||||
/// `WorkerAvailable` is an interest from `Worker` notifying `Accept` there is a worker
|
/// `WorkerAvailable` is an interest from `Worker` notifying `Accept` there is a worker
|
||||||
/// available and can accept new tasks.
|
/// available and can accept new tasks.
|
||||||
|
@ -102,8 +102,8 @@ pub trait Service<Req> {
|
|||||||
/// call and the next invocation of `call` results in an error.
|
/// call and the next invocation of `call` results in an error.
|
||||||
///
|
///
|
||||||
/// # Notes
|
/// # Notes
|
||||||
/// 1. `.poll_ready()` might be called on different task from actual service call.
|
/// 1. `poll_ready` might be called on a different task to `call`.
|
||||||
/// 1. In case of chained services, `.poll_ready()` get called for all services at once.
|
/// 1. In cases of chained services, `.poll_ready()` is called for all services at once.
|
||||||
fn poll_ready(&self, ctx: &mut task::Context<'_>) -> Poll<Result<(), Self::Error>>;
|
fn poll_ready(&self, ctx: &mut task::Context<'_>) -> Poll<Result<(), Self::Error>>;
|
||||||
|
|
||||||
/// Process the request and return the response asynchronously.
|
/// Process the request and return the response asynchronously.
|
||||||
|
Loading…
Reference in New Issue
Block a user