1
0
mirror of https://github.com/actix/actix-website synced 2025-08-19 04:15:40 +02:00

Update examples/{extractors, errors} to futures 0.3 and actix-web 2.0 (#130)

* Update to futures 0.3

* update examples/errors to actix-web 2.0
This commit is contained in:
Dominic
2019-12-28 16:26:17 +01:00
committed by Yuki Okushi
parent c6c5446937
commit 20517d415d
17 changed files with 120 additions and 102 deletions

View File

@@ -12,13 +12,14 @@ pub struct MyError {
// Use default implementation for `error_response()` method
impl error::ResponseError for MyError {}
pub fn index() -> Result<&'static str, MyError> {
async fn index() -> Result<&'static str, MyError> {
let err = MyError { name: "test error" };
debug!("{}", err);
Err(err)
}
pub fn main() {
#[actix_rt::main]
async fn main() -> std::io::Result<()> {
use actix_web::{middleware::Logger, web, App, HttpServer};
std::env::set_var("RUST_LOG", "my_errors=debug,actix_web=info");
@@ -30,9 +31,8 @@ pub fn main() {
.wrap(Logger::default())
.route("/", web::get().to(index))
})
.bind("127.0.0.1:8088")
.unwrap()
.bind("127.0.0.1:8088")?
.run()
.unwrap();
.await
}
// </logging>