mirror of https://github.com/fafhrd91/actix-web
fmt
This commit is contained in:
parent
ac8f4fb0f7
commit
05083fcd40
|
@ -130,12 +130,12 @@ pub mod dev {
|
|||
//! ```
|
||||
|
||||
pub use crate::config::{AppConfig, AppService};
|
||||
pub use actix_service::fn_factory;
|
||||
#[doc(hidden)]
|
||||
pub use crate::handler::Handler;
|
||||
pub use crate::info::ConnectionInfo;
|
||||
pub use crate::rmap::ResourceMap;
|
||||
pub use crate::service::{HttpServiceFactory, ServiceRequest, ServiceResponse, WebService};
|
||||
pub use actix_service::fn_factory;
|
||||
|
||||
pub use crate::types::form::UrlEncoded;
|
||||
pub use crate::types::json::JsonBody;
|
||||
|
|
14
src/route.rs
14
src/route.rs
|
@ -134,29 +134,29 @@ impl Route {
|
|||
/// # use std::pin::Pin;
|
||||
/// # use std::future::Future;
|
||||
/// use futures_util::future::{ok, LocalBoxFuture};
|
||||
///
|
||||
///
|
||||
/// struct HelloWorld;
|
||||
///
|
||||
///
|
||||
/// impl Service<ServiceRequest> for HelloWorld {
|
||||
/// type Response = ServiceResponse;
|
||||
/// type Error = actix_web::Error;
|
||||
/// type Future = LocalBoxFuture<'static, Result<Self::Response, Self::Error>>;
|
||||
///
|
||||
///
|
||||
/// fn poll_ready(&self, _: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||
/// Poll::Ready(Ok(()))
|
||||
/// }
|
||||
///
|
||||
///
|
||||
/// fn call(&self, req: ServiceRequest) -> Self::Future {
|
||||
/// let (req, _) = req.into_parts();
|
||||
///
|
||||
///
|
||||
/// let res = HttpResponse::Ok()
|
||||
/// .insert_header(header::ContentType::plaintext())
|
||||
/// .body("Hello world!");
|
||||
///
|
||||
///
|
||||
/// Box::pin(ok(ServiceResponse::new(req, res)))
|
||||
/// }
|
||||
/// }
|
||||
///
|
||||
///
|
||||
/// App::new().service(
|
||||
/// web::resource("/").route(web::get().service(fn_factory(|| ok(HelloWorld))))
|
||||
/// );
|
||||
|
|
Loading…
Reference in New Issue