diff --git a/Cargo.lock b/Cargo.lock index 79252ec..755d7f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1548,7 +1548,7 @@ dependencies = [ "rand 0.7.3", "serde 1.0.136", "serde_json", - "uuid 0.8.2", + "uuid", ] [[package]] @@ -1567,7 +1567,7 @@ dependencies = [ "serde 1.0.136", "serde_bytes", "serde_json", - "uuid 0.8.2", + "uuid", ] [[package]] @@ -2258,7 +2258,7 @@ dependencies = [ "libsqlite3-sys 0.9.1", "pq-sys", "r2d2", - "uuid 0.8.2", + "uuid", ] [[package]] @@ -2273,7 +2273,7 @@ dependencies = [ "futures", "serde 1.0.136", "serde_json", - "uuid 0.8.2", + "uuid", ] [[package]] @@ -3357,7 +3357,7 @@ dependencies = [ "smartstring", "static_assertions 1.1.0", "url", - "uuid 0.8.2", + "uuid", ] [[package]] @@ -3374,7 +3374,7 @@ dependencies = [ "r2d2_mysql", "serde 1.0.136", "serde_json", - "uuid 0.8.2", + "uuid", ] [[package]] @@ -3830,7 +3830,7 @@ dependencies = [ "trust-dns-proto 0.20.4", "trust-dns-resolver 0.20.4", "typed-builder", - "uuid 0.8.2", + "uuid", "version_check 0.9.4", "webpki 0.21.4", "webpki-roots 0.21.1", @@ -3862,7 +3862,7 @@ dependencies = [ "actix-web 4.0.0-rc.2", "futures-util", "sanitize-filename", - "uuid 0.8.2", + "uuid", ] [[package]] @@ -3930,7 +3930,7 @@ dependencies = [ "sha2 0.8.2", "time 0.1.43", "twox-hash", - "uuid 0.8.2", + "uuid", ] [[package]] @@ -4622,18 +4622,6 @@ dependencies = [ "scheduled-thread-pool", ] -[[package]] -name = "r2d2-example" -version = "1.0.0" -dependencies = [ - "actix-web 4.0.0-rc.2", - "env_logger 0.9.0", - "r2d2", - "r2d2_sqlite", - "rusqlite", - "uuid 1.0.0-alpha.1", -] - [[package]] name = "r2d2_mysql" version = "17.0.0" @@ -5535,7 +5523,7 @@ dependencies = [ "serde_json", "sparkpost", "time 0.3.7", - "uuid 0.8.2", + "uuid", ] [[package]] @@ -6693,15 +6681,6 @@ dependencies = [ "serde 1.0.136", ] -[[package]] -name = "uuid" -version = "1.0.0-alpha.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb3ab47baa004111b323696c6eaa2752e7356f7f77cf6b6dc7a2087368ce1ca4" -dependencies = [ - "getrandom 0.2.4", -] - [[package]] name = "v_escape" version = "0.13.2" diff --git a/Cargo.toml b/Cargo.toml index e1cc88c..f5221b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,6 @@ members = [ "database_interactions/diesel", "database_interactions/mongodb", "database_interactions/pg", - "database_interactions/r2d2", "database_interactions/redis", "database_interactions/simple-auth-server", "forms/form", diff --git a/basics/error_handling/src/main.rs b/basics/error_handling/src/main.rs index ee16246..5ea39f2 100644 --- a/basics/error_handling/src/main.rs +++ b/basics/error_handling/src/main.rs @@ -42,7 +42,7 @@ impl Distribution for Standard { } } -/// Actix web uses `ResponseError` for conversion of errors to a response +/// Actix Web uses `ResponseError` for conversion of errors to a response impl ResponseError for CustomError { fn error_response(&self) -> HttpResponse { match self { diff --git a/database_interactions/diesel/README.md b/database_interactions/diesel/README.md index 2ed15d4..053d6d1 100644 --- a/database_interactions/diesel/README.md +++ b/database_interactions/diesel/README.md @@ -1,6 +1,6 @@ # diesel -Basic integration of [Diesel](https://diesel.rs/) using SQLite for Actix web. +Basic integration of [Diesel](https://diesel.rs/) using SQLite for Actix Web. ## Usage diff --git a/database_interactions/diesel/src/actions.rs b/database_interactions/diesel/src/actions.rs index 28cd6fb..010cf6d 100644 --- a/database_interactions/diesel/src/actions.rs +++ b/database_interactions/diesel/src/actions.rs @@ -26,7 +26,7 @@ pub fn insert_new_user( nm: &str, conn: &SqliteConnection, ) -> Result { - // It is common when using Diesel with Actix web to import schema-related + // It is common when using Diesel with Actix Web to import schema-related // modules inside a function's scope (rather than the normal module's scope) // to prevent import collisions and namespace pollution. use crate::schema::users::dsl::*; diff --git a/database_interactions/diesel/src/main.rs b/database_interactions/diesel/src/main.rs index 023bd19..610ab6c 100644 --- a/database_interactions/diesel/src/main.rs +++ b/database_interactions/diesel/src/main.rs @@ -1,4 +1,4 @@ -//! Actix web Diesel integration example +//! Actix Web Diesel integration example //! //! Diesel does not support tokio, so we have to run it in separate threads using the web::block //! function which offloads blocking code (like Diesel's) in order to not block the server's thread. diff --git a/database_interactions/mongodb/README.md b/database_interactions/mongodb/README.md index cad5346..d42b979 100644 --- a/database_interactions/mongodb/README.md +++ b/database_interactions/mongodb/README.md @@ -1,6 +1,6 @@ # MongoDB -Simple example of MongoDB usage with Actix web. For more information on the MongoDB Rust driver, +Simple example of MongoDB usage with Actix Web. For more information on the MongoDB Rust driver, visit the [documentation](https://docs.rs/mongodb/2.0.0/mongodb/index.html) and [source code](https://github.com/mongodb/mongo-rust-driver). @@ -22,4 +22,3 @@ MongoDB manual. ### Run the example To execute the example code, run `cargo run` in the `database_interactions/mongodb` directory. - diff --git a/database_interactions/r2d2/Cargo.toml b/database_interactions/r2d2/Cargo.toml deleted file mode 100644 index 6171fc2..0000000 --- a/database_interactions/r2d2/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "r2d2-example" -version = "1.0.0" -edition = "2021" - -[dependencies] -actix-web = "4.0.0-rc.1" - -env_logger = "0.9.0" -uuid = { version = "1.0.0-alpha.1", features = ["v4"] } - -r2d2 = "0.8" -r2d2_sqlite = "0.18.0" -rusqlite = "0.25.4" diff --git a/database_interactions/r2d2/src/main.rs b/database_interactions/r2d2/src/main.rs deleted file mode 100644 index 4b07576..0000000 --- a/database_interactions/r2d2/src/main.rs +++ /dev/null @@ -1,57 +0,0 @@ -//! Actix web r2d2 example -use std::io; - -use actix_web::{ - error::InternalError, http::StatusCode, middleware, web, App, Error, HttpResponse, - HttpServer, -}; -use r2d2::Pool; -use r2d2_sqlite::SqliteConnectionManager; - -/// Async request handler. Ddb pool is stored in application state. -async fn index( - path: web::Path, - db: web::Data>, -) -> Result { - // execute sync code in threadpool - let res = web::block(move || { - let conn = db.get().unwrap(); - - let uuid = format!("{}", uuid::Uuid::new_v4()); - conn.execute( - "INSERT INTO users (id, name) VALUES ($1, $2)", - &[&uuid, &path.into_inner()], - ) - .unwrap(); - - conn.query_row("SELECT name FROM users WHERE id=$1", &[&uuid], |row| { - row.get::<_, String>(0) - }) - }) - .await - .unwrap() - .map(|user| HttpResponse::Ok().json(user)) - .map_err(|e| InternalError::new(e, StatusCode::INTERNAL_SERVER_ERROR))?; - Ok(res) -} - -#[actix_web::main] -async fn main() -> io::Result<()> { - std::env::set_var("RUST_LOG", "actix_web=debug"); - env_logger::init(); - - // r2d2 pool - let manager = SqliteConnectionManager::file("test.db"); - let pool = r2d2::Pool::new(manager).unwrap(); - - // start http server - HttpServer::new(move || { - App::new() - .app_data(web::Data::new(pool.clone())) // <- store db pool in app state - .wrap(middleware::Logger::default()) - .route("/{name}", web::get().to(index)) - }) - .bind("127.0.0.1:8080")? - .run() - .await -} diff --git a/database_interactions/simple-auth-server/README.md b/database_interactions/simple-auth-server/README.md index 6d4c398..73c2eaf 100644 --- a/database_interactions/simple-auth-server/README.md +++ b/database_interactions/simple-auth-server/README.md @@ -17,7 +17,7 @@ ### Crates Used -- [actix-web](https://crates.io/crates/actix-web) // Actix web is a simple, pragmatic and extremely fast web framework for Rust. +- [actix-web](https://crates.io/crates/actix-web) // Actix Web is a simple, pragmatic and extremely fast web framework for Rust. - [rust-argon2](https://crates.io/crates/rust-argon2) // crate for hashing passwords using the cryptographically-secure Argon2 hashing algorithm. - [chrono](https://crates.io/crates/chrono) // Date and time library for Rust. - [diesel](https://crates.io/crates/diesel) // A safe, extensible ORM and Query Builder for PostgreSQL, SQLite, and MySQL. diff --git a/graphql/graphql-demo/README.md b/graphql/graphql-demo/README.md index 7312a5c..9b18f9f 100644 --- a/graphql/graphql-demo/README.md +++ b/graphql/graphql-demo/README.md @@ -1,4 +1,4 @@ -Getting started using [Async-graphql](https://github.com/async-graphql/async-graphql) with Actix web. +Getting started using [Async-graphql](https://github.com/async-graphql/async-graphql) with Actix Web. ## Run @@ -31,4 +31,4 @@ cargo run --bin async-graphql-demo } } } -``` \ No newline at end of file +``` diff --git a/graphql/juniper/README.md b/graphql/juniper/README.md index 7a7c0d7..982db64 100644 --- a/graphql/juniper/README.md +++ b/graphql/juniper/README.md @@ -1,6 +1,6 @@ # Juniper -[Juniper](https://github.com/graphql-rust/juniper) integration for Actix web. +[Juniper](https://github.com/graphql-rust/juniper) integration for Actix Web. If you want more advanced example, see also the [juniper-advanced example]. [juniper-advanced example]: https://github.com/actix/examples/tree/master/graphql/juniper-advanced diff --git a/graphql/juniper/src/main.rs b/graphql/juniper/src/main.rs index 64e0b3b..9d7ac40 100644 --- a/graphql/juniper/src/main.rs +++ b/graphql/juniper/src/main.rs @@ -1,4 +1,4 @@ -//! Actix web juniper example +//! Actix Web juniper example //! //! A simple example integrating juniper in Actix Web use std::io; diff --git a/json/json/README.md b/json/json/README.md index 3e6ee5d..f83b755 100644 --- a/json/json/README.md +++ b/json/json/README.md @@ -1,6 +1,6 @@ # json -Json's `Getting Started` guide using json (serde-json or json-rust) for Actix web +Json's `Getting Started` guide using json (serde-json or json-rust) for Actix Web ## Usage diff --git a/security/casbin/README.md b/security/casbin/README.md index 6a3897a..81a5fa3 100644 --- a/security/casbin/README.md +++ b/security/casbin/README.md @@ -1,6 +1,6 @@ # Casbin -Basic integration of [Casbin-RS](https://github.com/casbin/casbin-rs) with [RBAC](https://en.wikipedia.org/wiki/Role-based_access_control) for Actix web. +Basic integration of [Casbin-RS](https://github.com/casbin/casbin-rs) with [RBAC](https://en.wikipedia.org/wiki/Role-based_access_control) for Actix Web. ## Usage diff --git a/template_engines/askama/templates/index.html b/template_engines/askama/templates/index.html index d8a47bc..293ec99 100644 --- a/template_engines/askama/templates/index.html +++ b/template_engines/askama/templates/index.html @@ -2,7 +2,7 @@ - Actix web + Actix Web

Welcome!

diff --git a/template_engines/askama/templates/user.html b/template_engines/askama/templates/user.html index cb53289..6aa345e 100644 --- a/template_engines/askama/templates/user.html +++ b/template_engines/askama/templates/user.html @@ -2,7 +2,7 @@ - Actix web + Actix Web

Hi, {{ name }}!

diff --git a/template_engines/tera/templates/index.html b/template_engines/tera/templates/index.html index d8a47bc..293ec99 100644 --- a/template_engines/tera/templates/index.html +++ b/template_engines/tera/templates/index.html @@ -2,7 +2,7 @@ - Actix web + Actix Web

Welcome!

diff --git a/template_engines/tera/templates/user.html b/template_engines/tera/templates/user.html index cb53289..6aa345e 100644 --- a/template_engines/tera/templates/user.html +++ b/template_engines/tera/templates/user.html @@ -2,7 +2,7 @@ - Actix web + Actix Web

Hi, {{ name }}!

diff --git a/template_engines/tinytemplate/templates/index.html b/template_engines/tinytemplate/templates/index.html index d8a47bc..293ec99 100644 --- a/template_engines/tinytemplate/templates/index.html +++ b/template_engines/tinytemplate/templates/index.html @@ -2,7 +2,7 @@ - Actix web + Actix Web

Welcome!

diff --git a/template_engines/tinytemplate/templates/user.html b/template_engines/tinytemplate/templates/user.html index 9f1a7b5..8e71d34 100644 --- a/template_engines/tinytemplate/templates/user.html +++ b/template_engines/tinytemplate/templates/user.html @@ -2,7 +2,7 @@ - Actix web + Actix Web

Hi, {name}!

diff --git a/template_engines/yarte/templates/index.hbs b/template_engines/yarte/templates/index.hbs index 64f9791..29130e4 100644 --- a/template_engines/yarte/templates/index.hbs +++ b/template_engines/yarte/templates/index.hbs @@ -1,4 +1,4 @@ -{{#> base title = "Actix web" }} +{{#> base title = "Actix Web" }} {{~#if let Some(name) = query.get("name") }} {{ let lastname = query.get("lastname").ok_or(MyErr("Bad query"))? }} {{> card/hi ~}}