diff --git a/examples/application/Cargo.toml b/examples/application/Cargo.toml index 9d9824d..9488e4d 100644 --- a/examples/application/Cargo.toml +++ b/examples/application/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "application" -version = "0.6.0" +version = "0.7.0" workspace = "../" [dependencies] -actix-web = "0.6" +actix-web = "0.7" diff --git a/examples/application/src/main.rs b/examples/application/src/main.rs index 71edd49..726f857 100644 --- a/examples/application/src/main.rs +++ b/examples/application/src/main.rs @@ -7,7 +7,7 @@ mod vh; fn make_app() { // -fn index(req: HttpRequest) -> impl Responder { +fn index(req: &HttpRequest) -> impl Responder { "Hello world!" } diff --git a/examples/application/src/state.rs b/examples/application/src/state.rs index 4462953..062006c 100644 --- a/examples/application/src/state.rs +++ b/examples/application/src/state.rs @@ -7,7 +7,7 @@ struct AppState { counter: Cell, } -fn index(req: HttpRequest) -> String { +fn index(req: &HttpRequest) -> String { let count = req.state().counter.get() + 1; // <- get count req.state().counter.set(count); // <- store new count in state diff --git a/examples/getting-started/Cargo.toml b/examples/getting-started/Cargo.toml index 1a75d14..226c730 100644 --- a/examples/getting-started/Cargo.toml +++ b/examples/getting-started/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "getting-started" -version = "0.6.0" +version = "0.7.0" workspace = "../" [dependencies] -actix-web = "0.6" +actix-web = "0.7" diff --git a/examples/getting-started/src/main.rs b/examples/getting-started/src/main.rs index a3e7e09..494bec4 100644 --- a/examples/getting-started/src/main.rs +++ b/examples/getting-started/src/main.rs @@ -2,7 +2,7 @@ extern crate actix_web; use actix_web::{server, App, HttpRequest}; -fn index(_req: HttpRequest) -> &'static str { +fn index(_req: &HttpRequest) -> &'static str { "Hello world!" } // diff --git a/examples/server/Cargo.toml b/examples/server/Cargo.toml index 1d394c7..94e8f33 100644 --- a/examples/server/Cargo.toml +++ b/examples/server/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "server" -version = "0.6.0" +version = "0.7.0" workspace = "../" [dependencies] -actix = "0.5" -actix-web = { version="0.6", features=["alpn"] } +actix = "0.7" +actix-web = { version="0.7", features=["alpn"] } futures = "0.1" openssl = "0.10" diff --git a/examples/server/src/ssl.rs b/examples/server/src/ssl.rs index 63dfd83..2b58256 100644 --- a/examples/server/src/ssl.rs +++ b/examples/server/src/ssl.rs @@ -2,7 +2,7 @@ use actix_web::{server, App, HttpRequest, Responder}; use openssl::ssl::{SslAcceptor, SslFiletype, SslMethod}; -fn index(req: HttpRequest) -> impl Responder { +fn index(req: &HttpRequest) -> impl Responder { "Welcome!" } diff --git a/examples/url-dispatch/Cargo.toml b/examples/url-dispatch/Cargo.toml index 19156e4..b6d081c 100644 --- a/examples/url-dispatch/Cargo.toml +++ b/examples/url-dispatch/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "url-dispatch" -version = "0.6.0" +version = "0.7.0" workspace = "../" [dependencies] -actix = "0.5" -actix-web = "0.6" +actix = "0.7" +actix-web = "0.7" futures = "0.1" openssl = "0.10" serde = "1.0" diff --git a/examples/url-dispatch/src/minfo.rs b/examples/url-dispatch/src/minfo.rs index 911927a..2c05a57 100644 --- a/examples/url-dispatch/src/minfo.rs +++ b/examples/url-dispatch/src/minfo.rs @@ -1,7 +1,7 @@ // use actix_web::{App, HttpRequest, Result}; -fn index(req: HttpRequest) -> Result { +fn index(req: &HttpRequest) -> Result { let v1: u8 = req.match_info().query("v1")?; let v2: u8 = req.match_info().query("v2")?; Ok(format!("Values {} {}", v1, v2)) diff --git a/examples/url-dispatch/src/norm.rs b/examples/url-dispatch/src/norm.rs index 4bbb00e..fcdbd50 100644 --- a/examples/url-dispatch/src/norm.rs +++ b/examples/url-dispatch/src/norm.rs @@ -10,6 +10,6 @@ fn main() { // use actix_web::HttpRequest; -fn index(req: HttpRequest) -> String { +fn index(req: &HttpRequest) -> String { unimplemented!() } diff --git a/examples/url-dispatch/src/norm2.rs b/examples/url-dispatch/src/norm2.rs index d8b970d..7a4fb91 100644 --- a/examples/url-dispatch/src/norm2.rs +++ b/examples/url-dispatch/src/norm2.rs @@ -11,6 +11,6 @@ fn main() { use actix_web::HttpRequest; -fn index(req: HttpRequest) -> String { +fn index(req: &HttpRequest) -> String { unimplemented!() } diff --git a/examples/url-dispatch/src/pbuf.rs b/examples/url-dispatch/src/pbuf.rs index 71c2b1d..b18ae35 100644 --- a/examples/url-dispatch/src/pbuf.rs +++ b/examples/url-dispatch/src/pbuf.rs @@ -2,7 +2,7 @@ use actix_web::{http::Method, App, HttpRequest, Result}; use std::path::PathBuf; -fn index(req: HttpRequest) -> Result { +fn index(req: &HttpRequest) -> Result { let path: PathBuf = req.match_info().query("tail")?; Ok(format!("Path {:?}", path)) } diff --git a/examples/url-dispatch/src/pred.rs b/examples/url-dispatch/src/pred.rs index e5a873d..2fda5a5 100644 --- a/examples/url-dispatch/src/pred.rs +++ b/examples/url-dispatch/src/pred.rs @@ -1,10 +1,10 @@ // -use actix_web::{http, pred::Predicate, App, HttpMessage, HttpRequest, HttpResponse}; +use actix_web::{http, server::Request, pred::Predicate, App, HttpResponse}; struct ContentTypeHeader; impl Predicate for ContentTypeHeader { - fn check(&self, req: &mut HttpRequest) -> bool { + fn check(&self, req: &Request, state: &S) -> bool { req.headers().contains_key(http::header::CONTENT_TYPE) } } diff --git a/examples/url-dispatch/src/prefix.rs b/examples/url-dispatch/src/prefix.rs index 94e5543..8b3985d 100644 --- a/examples/url-dispatch/src/prefix.rs +++ b/examples/url-dispatch/src/prefix.rs @@ -1,7 +1,7 @@ use actix_web::{App, HttpRequest, HttpResponse}; // -fn show_users(req: HttpRequest) -> HttpResponse { +fn show_users(req: &HttpRequest) -> HttpResponse { unimplemented!() } diff --git a/examples/url-dispatch/src/resource.rs b/examples/url-dispatch/src/resource.rs index e997fc7..aebfebd 100644 --- a/examples/url-dispatch/src/resource.rs +++ b/examples/url-dispatch/src/resource.rs @@ -1,7 +1,7 @@ // use actix_web::{http::Method, App, HttpRequest, HttpResponse}; -fn index(req: HttpRequest) -> HttpResponse { +fn index(req: &HttpRequest) -> HttpResponse { unimplemented!() } diff --git a/examples/url-dispatch/src/scope.rs b/examples/url-dispatch/src/scope.rs index 42dd8a4..8c8f5bd 100644 --- a/examples/url-dispatch/src/scope.rs +++ b/examples/url-dispatch/src/scope.rs @@ -1,22 +1,22 @@ #![allow(dead_code)] use actix_web::{http::Method, App, HttpRequest}; -fn get_projects(_: HttpRequest) -> String { +fn get_projects(_: &HttpRequest) -> String { unimplemented!() } -fn create_project(_: HttpRequest) -> String { +fn create_project(_: &HttpRequest) -> String { unimplemented!() } fn update_project(_: HttpRequest) -> String { unimplemented!() } -fn delete_project(_: HttpRequest) -> String { +fn delete_project(_: &HttpRequest) -> String { unimplemented!() } -fn get_tasks(_: HttpRequest) -> String { +fn get_tasks(_: &HttpRequest) -> String { unimplemented!() } -fn create_task(_: HttpRequest) -> String { +fn create_task(_: &HttpRequest) -> String { unimplemented!() } fn update_task(_: HttpRequest) -> String { diff --git a/examples/url-dispatch/src/url_ext.rs b/examples/url-dispatch/src/url_ext.rs index b8aaa11..f02f14f 100644 --- a/examples/url-dispatch/src/url_ext.rs +++ b/examples/url-dispatch/src/url_ext.rs @@ -1,7 +1,7 @@ // use actix_web::{App, Error, HttpRequest, HttpResponse}; -fn index(mut req: HttpRequest) -> Result { +fn index(req: &HttpRequest) -> Result { let url = req.url_for("youtube", &["oHg5SJYRHA0"])?; assert_eq!(url.as_str(), "https://youtube.com/watch/oHg5SJYRHA0"); Ok(HttpResponse::Ok().into())