1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-26 02:19:22 +02:00

add extractors info to guide

This commit is contained in:
Nikolay Kim
2018-03-31 09:18:25 -07:00
parent 3ee228005d
commit 16c212f853
7 changed files with 64 additions and 9 deletions

View File

@ -47,9 +47,7 @@ use httpresponse::HttpResponse;
/// ## Example
///
/// ```rust
/// # extern crate bytes;
/// # extern crate actix_web;
/// # extern crate futures;
/// #[macro_use] extern crate serde_derive;
/// use actix_web::{App, Json, Result, http};
///

View File

@ -8,7 +8,8 @@ use httprequest::HttpRequest;
/// Trait defines resource route predicate.
/// Predicate can modify request object. It is also possible to
/// to store extra attributes on request by using `.extensions()` method.
/// to store extra attributes on request by using `Extensions` container,
/// Extensions container available via `HttpRequest::extensions()` method.
pub trait Predicate<S> {
/// Check if request matches predicate

View File

@ -126,12 +126,16 @@ impl HttpHandler for Box<HttpHandler> {
}
}
#[doc(hidden)]
pub trait HttpHandlerTask {
/// Poll task, this method is used before or after *io* object is available
fn poll(&mut self) -> Poll<(), Error>;
/// Poll task when *io* object is available
fn poll_io(&mut self, io: &mut Writer) -> Poll<bool, Error>;
/// Connection is disconnected
fn disconnected(&mut self);
}
@ -152,12 +156,14 @@ impl<T: HttpHandler> IntoHttpHandler for T {
}
}
#[doc(hidden)]
#[derive(Debug)]
pub enum WriterState {
Done,
Pause,
}
#[doc(hidden)]
/// Stream writer
pub trait Writer {
fn written(&self) -> u64;
@ -172,6 +178,7 @@ pub trait Writer {
fn poll_completed(&mut self, shutdown: bool) -> Poll<(), io::Error>;
}
#[doc(hidden)]
/// Low-level io stream operations
pub trait IoStream: AsyncRead + AsyncWrite + 'static {
fn shutdown(&mut self, how: Shutdown) -> io::Result<()>;

View File

@ -10,7 +10,7 @@
//! # extern crate actix_web;
//! # use actix::*;
//! # use actix_web::*;
//! use actix_web::ws;
//! use actix_web::{ws, HttpRequest, HttpResponse};
//!
//! // do websocket handshake and start actor
//! fn ws_index(req: HttpRequest) -> Result<HttpResponse> {