1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-31 08:57:00 +02:00

Add missing API docs

These were written without much knowledge of the actix-web internals!
Please review carefully!
This commit is contained in:
Pascal Hertleif
2018-06-02 15:51:58 +02:00
parent 47b7be4fd3
commit 890a7e70d6
24 changed files with 82 additions and 2 deletions

View File

@@ -102,9 +102,12 @@ where
A: Actor<Context = Self>,
{
#[inline]
/// Create a new HTTP Context from a request and an actor
pub fn new(req: HttpRequest<S>, actor: A) -> HttpContext<A, S> {
HttpContext::from_request(req).actor(actor)
}
/// Create a new HTTP Context from a request
pub fn from_request(req: HttpRequest<S>) -> HttpContext<A, S> {
HttpContext {
inner: ContextImpl::new(None),
@@ -113,7 +116,9 @@ where
disconnected: false,
}
}
#[inline]
/// Set the actor of this context
pub fn actor(mut self, actor: A) -> HttpContext<A, S> {
self.inner.set_actor(actor);
self
@@ -239,12 +244,14 @@ where
}
}
/// Consume a future
pub struct Drain<A> {
fut: oneshot::Receiver<()>,
_a: PhantomData<A>,
}
impl<A> Drain<A> {
/// Create a drain from a future
pub fn new(fut: oneshot::Receiver<()>) -> Self {
Drain {
fut,