1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-12-30 03:50:42 +00:00

remove wrong doc example

This commit is contained in:
Nikolay Kim 2018-09-11 11:28:13 -07:00
parent b0d120c101
commit f0554efb98
3 changed files with 14 additions and 38 deletions

View file

@ -75,23 +75,20 @@ fn main() {
// service for converting incoming TcpStream to a SslStream<TcpStream>
(move |stream| {
SslAcceptorExt::accept_async(&acceptor, stream)
.map_err(|e| println!("Openssl error: {}", e))
})
// convert closure to a `NewService`
.into_new_service()
// .and_then() combinator uses other service to convert incoming `Request` to a `Response`
// and then uses that response as an input for next service.
// in this case, on success we use `logger` service
.and_then(logger)
// next service uses two components, service state and service function
// actix-net generates `NewService` impl that creates `ServiceState` instance for each new service
// and use `service` function as `Service::call`
.and_then((service, move || {
Ok(ServiceState { num: num.clone() })
}))
SslAcceptorExt::accept_async(&acceptor, stream)
.map_err(|e| println!("Openssl error: {}", e))
})
// convert closure to a `NewService`
.into_new_service()
// .and_then() combinator uses other service to convert incoming `Request` to a
// `Response` and then uses that response as an input for next
// service. in this case, on success we use `logger` service
.and_then(logger)
// next service uses two components, service state and service function
// actix-net generates `NewService` impl that creates `ServiceState` instance
// for each new service and use `service` function as
// `Service::call`
.and_then((service, move || Ok(ServiceState { num: num.clone() })))
},
).unwrap()
.start();

View file

@ -5,7 +5,6 @@
//! * `tls` - enables ssl support via `native-tls` crate
//! * `ssl` - enables ssl support via `openssl` crate
//! * `rust-tls` - enables ssl support via `rustls` crate
//!
// #![warn(missing_docs)]
#![cfg_attr(

View file

@ -113,26 +113,6 @@ impl Server {
///
/// This function is useful for moving parts of configuration to a
/// 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
where
F: Fn(Server) -> Server,