mirror of
https://github.com/actix/actix-web.git
synced 2025-01-04 14:28:50 +00:00
remove wrong doc example
This commit is contained in:
parent
b0d120c101
commit
f0554efb98
3 changed files with 14 additions and 38 deletions
|
@ -80,18 +80,15 @@ fn main() {
|
||||||
})
|
})
|
||||||
// convert closure to a `NewService`
|
// convert closure to a `NewService`
|
||||||
.into_new_service()
|
.into_new_service()
|
||||||
|
// .and_then() combinator uses other service to convert incoming `Request` to a
|
||||||
// .and_then() combinator uses other service to convert incoming `Request` to a `Response`
|
// `Response` and then uses that response as an input for next
|
||||||
// and then uses that response as an input for next service.
|
// service. in this case, on success we use `logger` service
|
||||||
// in this case, on success we use `logger` service
|
|
||||||
.and_then(logger)
|
.and_then(logger)
|
||||||
|
|
||||||
// next service uses two components, service state and service function
|
// next service uses two components, service state and service function
|
||||||
// actix-net generates `NewService` impl that creates `ServiceState` instance for each new service
|
// actix-net generates `NewService` impl that creates `ServiceState` instance
|
||||||
// and use `service` function as `Service::call`
|
// for each new service and use `service` function as
|
||||||
.and_then((service, move || {
|
// `Service::call`
|
||||||
Ok(ServiceState { num: num.clone() })
|
.and_then((service, move || Ok(ServiceState { num: num.clone() })))
|
||||||
}))
|
|
||||||
},
|
},
|
||||||
).unwrap()
|
).unwrap()
|
||||||
.start();
|
.start();
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
//! * `tls` - enables ssl support via `native-tls` crate
|
//! * `tls` - enables ssl support via `native-tls` crate
|
||||||
//! * `ssl` - enables ssl support via `openssl` crate
|
//! * `ssl` - enables ssl support via `openssl` crate
|
||||||
//! * `rust-tls` - enables ssl support via `rustls` crate
|
//! * `rust-tls` - enables ssl support via `rustls` crate
|
||||||
//!
|
|
||||||
// #![warn(missing_docs)]
|
// #![warn(missing_docs)]
|
||||||
|
|
||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
|
|
|
@ -113,26 +113,6 @@ impl Server {
|
||||||
///
|
///
|
||||||
/// This function is useful for moving parts of configuration to a
|
/// This function is useful for moving parts of configuration to a
|
||||||
/// different module or event library.
|
/// different module or event library.
|
||||||
///
|
|
||||||
/// ```rust
|
|
||||||
/// # extern crate actix_web;
|
|
||||||
/// use actix_web::{fs, middleware, App, HttpResponse};
|
|
||||||
///
|
|
||||||
/// // this function could be located in different module
|
|
||||||
/// fn config(app: App) -> App {
|
|
||||||
/// app.resource("/test", |r| {
|
|
||||||
/// r.get().f(|_| HttpResponse::Ok());
|
|
||||||
/// r.head().f(|_| HttpResponse::MethodNotAllowed());
|
|
||||||
/// })
|
|
||||||
/// }
|
|
||||||
///
|
|
||||||
/// fn main() {
|
|
||||||
/// let app = App::new()
|
|
||||||
/// .middleware(middleware::Logger::default())
|
|
||||||
/// .configure(config) // <- register resources
|
|
||||||
/// .handler("/static", fs::StaticFiles::new(".").unwrap());
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
pub fn configure<F>(self, cfg: F) -> Server
|
pub fn configure<F>(self, cfg: F) -> Server
|
||||||
where
|
where
|
||||||
F: Fn(Server) -> Server,
|
F: Fn(Server) -> Server,
|
||||||
|
|
Loading…
Reference in a new issue