1
0
mirror of https://github.com/actix/examples synced 2024-11-23 14:31:07 +01:00

chore: update pin-project

This commit is contained in:
Rob Ede 2024-07-07 01:42:16 +01:00
parent ea07cc2370
commit 03879899a5
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
13 changed files with 43 additions and 67 deletions

48
Cargo.lock generated
View File

@ -4196,16 +4196,6 @@ dependencies = [
"unicode-normalization", "unicode-normalization",
] ]
[[package]]
name = "idna"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c"
dependencies = [
"unicode-bidi",
"unicode-normalization",
]
[[package]] [[package]]
name = "idna" name = "idna"
version = "0.5.0" version = "0.5.0"
@ -4216,12 +4206,6 @@ dependencies = [
"unicode-normalization", "unicode-normalization",
] ]
[[package]]
name = "if_chain"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed"
[[package]] [[package]]
name = "ignore" name = "ignore"
version = "0.4.20" version = "0.4.20"
@ -4975,7 +4959,7 @@ dependencies = [
"env_logger", "env_logger",
"futures-util", "futures-util",
"log", "log",
"pin-project", "pin-project-lite 0.2.13",
] ]
[[package]] [[package]]
@ -9121,12 +9105,12 @@ dependencies = [
[[package]] [[package]]
name = "validator" name = "validator"
version = "0.16.1" version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b92f40481c04ff1f4f61f304d61793c7b56ff76ac1469f1beb199b1445b253bd" checksum = "db79c75af171630a3148bd3e6d7c4f42b6a9a014c2945bc5ed0020cbb8d9478e"
dependencies = [ dependencies = [
"idna 0.4.0", "idna 0.5.0",
"lazy_static", "once_cell",
"regex", "regex",
"serde", "serde",
"serde_derive", "serde_derive",
@ -9137,28 +9121,16 @@ dependencies = [
[[package]] [[package]]
name = "validator_derive" name = "validator_derive"
version = "0.16.0" version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc44ca3088bb3ba384d9aecf40c6a23a676ce23e09bdaca2073d99c207f864af" checksum = "55591299b7007f551ed1eb79a684af7672c19c3193fb9e0a31936987bb2438ec"
dependencies = [ dependencies = [
"if_chain", "darling 0.20.3",
"lazy_static", "once_cell",
"proc-macro-error", "proc-macro-error",
"proc-macro2", "proc-macro2",
"quote", "quote",
"regex", "syn 2.0.48",
"syn 1.0.109",
"validator_types",
]
[[package]]
name = "validator_types"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "111abfe30072511849c5910134e8baf8dc05de4c0e5903d681cbd5c9c4d611e3"
dependencies = [
"proc-macro2",
"syn 1.0.109",
] ]
[[package]] [[package]]

View File

@ -104,6 +104,8 @@ color-eyre = "0.6"
futures-util = { version = "0.3.17", default-features = false, features = ["std"] } futures-util = { version = "0.3.17", default-features = false, features = ["std"] }
log = "0.4" log = "0.4"
openssl = { version = "0.10.60", features = ["v110"] } openssl = { version = "0.10.60", features = ["v110"] }
parking_lot = "0.12"
pin-project-lite = "0.2"
rand = "0.8" rand = "0.8"
rustls = "0.23" rustls = "0.23"
rustls-pemfile = "2" rustls-pemfile = "2"

View File

@ -9,5 +9,5 @@ diesel = { version = "2", features = ["sqlite", "r2d2", "uuid"] }
dotenvy.workspace = true dotenvy.workspace = true
env_logger.workspace = true env_logger.workspace = true
log.workspace = true log.workspace = true
serde = { version = "1.0", features = ["derive"] } serde.workspace = true
uuid.workspace = true uuid.workspace = true

View File

@ -9,7 +9,7 @@ config = "0.13"
deadpool-postgres = { version = "0.12", features = ["serde"] } deadpool-postgres = { version = "0.12", features = ["serde"] }
derive_more.workspace = true derive_more.workspace = true
dotenvy.workspace = true dotenvy.workspace = true
serde = { version = "1.0.137", features = ["derive"] } serde.workspace = true
tokio-pg-mapper = "0.2.0" tokio-pg-mapper = "0.2.0"
tokio-pg-mapper-derive = "0.2.0" tokio-pg-mapper-derive = "0.2.0"
tokio-postgres = "0.7.6" tokio-postgres = "0.7.6"

View File

@ -15,4 +15,4 @@ notify = "6"
rustls.workspace = true rustls.workspace = true
rustls-pemfile.workspace = true rustls-pemfile.workspace = true
tokio = { workspace = true, features = ["time", "rt", "macros"] } tokio = { workspace = true, features = ["time", "rt", "macros"] }
parking_lot = "0.12" parking_lot.workspace = true

View File

@ -8,5 +8,5 @@ actix-web.workspace = true
env_logger.workspace = true env_logger.workspace = true
log.workspace = true log.workspace = true
serde = { version = "1.0", features = ["derive"] } serde.workspace = true
serde_json.workspace = true serde_json.workspace = true

View File

@ -12,4 +12,4 @@ futures-util.workspace = true
log.workspace = true log.workspace = true
serde.workspace = true serde.workspace = true
serde_json.workspace = true serde_json.workspace = true
validator = { version = "0.16", features = ["derive"] } validator = { version = "0.18", features = ["derive"] }

View File

@ -7,5 +7,5 @@ edition = "2021"
actix-web.workspace = true actix-web.workspace = true
env_logger.workspace = true env_logger.workspace = true
log.workspace = true log.workspace = true
serde = { version = "1.0", features = ["derive"] } serde.workspace = true
serde_json.workspace = true serde_json.workspace = true

View File

@ -10,5 +10,5 @@ bytes = "1.1.0"
env_logger.workspace = true env_logger.workspace = true
futures-util.workspace = true futures-util.workspace = true
log.workspace = true log.workspace = true
serde = { version = "1.0", features = ["derive"] } serde.workspace = true
serde_json.workspace = true serde_json.workspace = true

View File

@ -12,4 +12,4 @@ actix-web-lab.workspace = true
env_logger.workspace = true env_logger.workspace = true
futures-util.workspace = true futures-util.workspace = true
log.workspace = true log.workspace = true
pin-project = "1" pin-project-lite.workspace = true

View File

@ -11,6 +11,7 @@ use actix_web::{
web::{Bytes, BytesMut}, web::{Bytes, BytesMut},
Error, Error,
}; };
use pin_project_lite::pin_project;
pub struct Logging; pub struct Logging;
@ -53,15 +54,16 @@ where
} }
} }
#[pin_project::pin_project] pin_project! {
pub struct WrapperStream<S, B> pub struct WrapperStream<S, B>
where where
B: MessageBody, B: MessageBody,
S: Service<ServiceRequest>, S: Service<ServiceRequest>,
{ {
#[pin] #[pin]
fut: S::Future, fut: S::Future,
_t: PhantomData<(B,)>, _t: PhantomData<(B,)>,
}
} }
impl<S, B> Future for WrapperStream<S, B> impl<S, B> Future for WrapperStream<S, B>
@ -83,17 +85,17 @@ where
} }
} }
#[pin_project::pin_project(PinnedDrop)] pin_project! {
pub struct BodyLogger<B> { pub struct BodyLogger<B> {
#[pin] #[pin]
body: B, body: B,
body_accum: BytesMut, body_accum: BytesMut,
} }
#[pin_project::pinned_drop] impl<B> PinnedDrop for BodyLogger<B> {
impl<B> PinnedDrop for BodyLogger<B> { fn drop(this: Pin<&mut Self>) {
fn drop(self: Pin<&mut Self>) { println!("response body: {:?}", this.body_accum);
println!("response body: {:?}", self.body_accum); }
} }
} }

View File

@ -9,6 +9,6 @@ actix-web-lab.workspace = true
env_logger.workspace = true env_logger.workspace = true
futures-util.workspace = true futures-util.workspace = true
log.workspace = true log.workspace = true
parking_lot = "0.12" parking_lot.workspace = true
tokio = { workspace = true, features = ["sync"] } tokio = { workspace = true, features = ["sync"] }
tokio-stream.workspace = true tokio-stream.workspace = true

View File

@ -10,4 +10,4 @@ actix-web-lab.workspace = true
env_logger.workspace = true env_logger.workspace = true
log.workspace = true log.workspace = true
parking_lot = "0.12" parking_lot.workspace = true