mirror of
https://github.com/fafhrd91/actix-net
synced 2025-06-26 17:27:42 +02:00
remove fn state service
This commit is contained in:
15
README.md
15
README.md
@ -47,14 +47,13 @@ fn main() {
|
||||
// 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()
|
||||
// Next service counts number of connections
|
||||
.and_then(move |req| {
|
||||
let num = num.fetch_add(1, Ordering::Relaxed);
|
||||
println!("processed {:?} connections", num);
|
||||
future::ok(())
|
||||
})
|
||||
}).unwrap()
|
||||
.start();
|
||||
|
||||
sys.run();
|
||||
|
Reference in New Issue
Block a user