This commit is contained in:
ibraheemdev 2021-06-11 22:10:47 -04:00
parent ac8f4fb0f7
commit 05083fcd40
2 changed files with 8 additions and 8 deletions

View File

@ -130,12 +130,12 @@ pub mod dev {
//! ``` //! ```
pub use crate::config::{AppConfig, AppService}; pub use crate::config::{AppConfig, AppService};
pub use actix_service::fn_factory;
#[doc(hidden)] #[doc(hidden)]
pub use crate::handler::Handler; pub use crate::handler::Handler;
pub use crate::info::ConnectionInfo; pub use crate::info::ConnectionInfo;
pub use crate::rmap::ResourceMap; pub use crate::rmap::ResourceMap;
pub use crate::service::{HttpServiceFactory, ServiceRequest, ServiceResponse, WebService}; pub use crate::service::{HttpServiceFactory, ServiceRequest, ServiceResponse, WebService};
pub use actix_service::fn_factory;
pub use crate::types::form::UrlEncoded; pub use crate::types::form::UrlEncoded;
pub use crate::types::json::JsonBody; pub use crate::types::json::JsonBody;

View File

@ -134,29 +134,29 @@ impl Route {
/// # use std::pin::Pin; /// # use std::pin::Pin;
/// # use std::future::Future; /// # use std::future::Future;
/// use futures_util::future::{ok, LocalBoxFuture}; /// use futures_util::future::{ok, LocalBoxFuture};
/// ///
/// struct HelloWorld; /// struct HelloWorld;
/// ///
/// impl Service<ServiceRequest> for HelloWorld { /// impl Service<ServiceRequest> for HelloWorld {
/// type Response = ServiceResponse; /// type Response = ServiceResponse;
/// type Error = actix_web::Error; /// type Error = actix_web::Error;
/// type Future = LocalBoxFuture<'static, Result<Self::Response, Self::Error>>; /// type Future = LocalBoxFuture<'static, Result<Self::Response, Self::Error>>;
/// ///
/// fn poll_ready(&self, _: &mut Context<'_>) -> Poll<Result<(), Self::Error>> { /// fn poll_ready(&self, _: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
/// Poll::Ready(Ok(())) /// Poll::Ready(Ok(()))
/// } /// }
/// ///
/// fn call(&self, req: ServiceRequest) -> Self::Future { /// fn call(&self, req: ServiceRequest) -> Self::Future {
/// let (req, _) = req.into_parts(); /// let (req, _) = req.into_parts();
/// ///
/// let res = HttpResponse::Ok() /// let res = HttpResponse::Ok()
/// .insert_header(header::ContentType::plaintext()) /// .insert_header(header::ContentType::plaintext())
/// .body("Hello world!"); /// .body("Hello world!");
/// ///
/// Box::pin(ok(ServiceResponse::new(req, res))) /// Box::pin(ok(ServiceResponse::new(req, res)))
/// } /// }
/// } /// }
/// ///
/// App::new().service( /// App::new().service(
/// web::resource("/").route(web::get().service(fn_factory(|| ok(HelloWorld)))) /// web::resource("/").route(web::get().service(fn_factory(|| ok(HelloWorld))))
/// ); /// );