1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-09-02 01:31:57 +02:00

refactor http actor usage

This commit is contained in:
Nikolay Kim
2017-12-31 17:26:32 -08:00
parent 967d3244d7
commit cc38b30f7b
22 changed files with 197 additions and 254 deletions

View File

@@ -65,7 +65,7 @@ impl<S> Handler<S> for MyHandler {
/// Handle request
fn handle(&mut self, req: HttpRequest<S>) -> Self::Result {
self.0 += 1;
httpcodes::HTTPOk.response()
httpcodes::HTTPOk.into()
}
}
# fn main() {}
@@ -91,7 +91,7 @@ impl<S> Handler<S> for MyHandler {
fn handle(&mut self, req: HttpRequest<S>) -> Self::Result {
let num = self.0.load(Ordering::Relaxed) + 1;
self.0.store(num, Ordering::Relaxed);
httpcodes::HTTPOk.response()
httpcodes::HTTPOk.into()
}
}
@@ -104,7 +104,7 @@ fn main() {
move || {
let cloned = inc.clone();
Application::new()
.resource("/", move |r| r.h(MyHandler(cloned)))
.resource("/", move |r| r.h(MyHandler(cloned)))
})
.bind("127.0.0.1:8088").unwrap()
.start();