✨ Updated dependencies, nix shell, justfile
- Updated all dependencies - Updated Rust edition to 2024 - Nix shell from flake - Added justfile - Mirgrate all changes to various packages
This commit is contained in:
parent
80f4af9087
commit
2f1eb4df3a
368
Cargo.lock
generated
368
Cargo.lock
generated
@ -1,6 +1,6 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "addr2line"
|
||||
@ -55,7 +55,7 @@ checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.76",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -66,13 +66,13 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
|
||||
|
||||
[[package]]
|
||||
name = "axum"
|
||||
version = "0.7.5"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf"
|
||||
checksum = "6d6fd624c75e18b3b4c6b9caf42b1afe24437daaee904069137d8bab077be8b8"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"axum-core",
|
||||
"bytes",
|
||||
"form_urlencoded",
|
||||
"futures-util",
|
||||
"http",
|
||||
"http-body",
|
||||
@ -91,9 +91,9 @@ dependencies = [
|
||||
"serde_json",
|
||||
"serde_path_to_error",
|
||||
"serde_urlencoded",
|
||||
"sync_wrapper 1.0.1",
|
||||
"sync_wrapper",
|
||||
"tokio",
|
||||
"tower 0.4.13",
|
||||
"tower 0.5.2",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
@ -101,11 +101,10 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "axum-core"
|
||||
version = "0.4.3"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3"
|
||||
checksum = "df1362f362fd16024ae199c1970ce98f9661bf5ef94b9808fee734bc3698b733"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"bytes",
|
||||
"futures-util",
|
||||
"http",
|
||||
@ -114,7 +113,7 @@ dependencies = [
|
||||
"mime",
|
||||
"pin-project-lite",
|
||||
"rustversion",
|
||||
"sync_wrapper 0.1.2",
|
||||
"sync_wrapper",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
@ -199,7 +198,7 @@ dependencies = [
|
||||
"serde_json",
|
||||
"serde_repr",
|
||||
"serde_urlencoded",
|
||||
"thiserror",
|
||||
"thiserror 1.0.63",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
"tower-service",
|
||||
@ -322,7 +321,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"strsim 0.11.1",
|
||||
"syn 2.0.76",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -333,7 +332,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"quote",
|
||||
"syn 2.0.76",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -386,7 +385,7 @@ dependencies = [
|
||||
"deluxe-macros",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"syn 2.0.76",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -399,7 +398,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"strsim 0.10.0",
|
||||
"syn 2.0.76",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -414,7 +413,7 @@ dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.76",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -429,22 +428,22 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "derive_more"
|
||||
version = "1.0.0"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05"
|
||||
checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678"
|
||||
dependencies = [
|
||||
"derive_more-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derive_more-impl"
|
||||
version = "1.0.0"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22"
|
||||
checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.76",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -482,7 +481,7 @@ dependencies = [
|
||||
"deluxe",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.76",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -493,20 +492,7 @@ dependencies = [
|
||||
"deadpool-diesel",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "diesel_async_migrations"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b92dd60c54ac548b3a001a040e92abdca9b55c68136c8a641ef776dfeb133a52"
|
||||
dependencies = [
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"diesel_async_migrations_macros",
|
||||
"scoped-futures",
|
||||
"tracing",
|
||||
"thiserror 2.0.12",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -542,7 +528,7 @@ dependencies = [
|
||||
"dsl_auto_type",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.76",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -551,7 +537,7 @@ version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "209c735641a413bc68c4923a9d6ad4bcb3ca306b794edaa7eb0b3228a99ffb25"
|
||||
dependencies = [
|
||||
"syn 2.0.76",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -565,27 +551,6 @@ dependencies = [
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs"
|
||||
version = "5.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225"
|
||||
dependencies = [
|
||||
"dirs-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs-sys"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"option-ext",
|
||||
"redox_users",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "docker_credential"
|
||||
version = "1.3.1"
|
||||
@ -626,7 +591,7 @@ dependencies = [
|
||||
"heck 0.5.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.76",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -650,12 +615,45 @@ version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "etcetera"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"home",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fallible-iterator"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7"
|
||||
|
||||
[[package]]
|
||||
name = "filetime"
|
||||
version = "0.2.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"libredox",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fnv"
|
||||
version = "1.0.7"
|
||||
@ -727,7 +725,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.76",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1046,7 +1044,7 @@ name = "into-response-derive"
|
||||
version = "1.1.0"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 2.0.76",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1072,7 +1070,7 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||
|
||||
[[package]]
|
||||
name = "lib"
|
||||
version = "1.4.3"
|
||||
version = "1.5.0"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"axum",
|
||||
@ -1083,18 +1081,18 @@ dependencies = [
|
||||
"diesel-async",
|
||||
"diesel-crud-derive",
|
||||
"diesel-crud-trait",
|
||||
"diesel_async_migrations 0.15.0",
|
||||
"diesel_async_migrations",
|
||||
"into-response-derive",
|
||||
"mime",
|
||||
"nom",
|
||||
"read-files",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"testcontainers-modules 0.10.0",
|
||||
"thiserror",
|
||||
"testcontainers-modules",
|
||||
"thiserror 2.0.12",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
"tower 0.5.0",
|
||||
"tower 0.5.2",
|
||||
"tower-http",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
@ -1102,9 +1100,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.158"
|
||||
version = "0.2.170"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439"
|
||||
checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828"
|
||||
|
||||
[[package]]
|
||||
name = "libredox"
|
||||
@ -1114,8 +1112,15 @@ checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"libc",
|
||||
"redox_syscall 0.5.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.4.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.12"
|
||||
@ -1134,9 +1139,9 @@ checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
|
||||
|
||||
[[package]]
|
||||
name = "matchit"
|
||||
version = "0.7.3"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94"
|
||||
checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3"
|
||||
|
||||
[[package]]
|
||||
name = "md-5"
|
||||
@ -1160,12 +1165,6 @@ version = "0.3.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
|
||||
|
||||
[[package]]
|
||||
name = "minimal-lexical"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.7.4"
|
||||
@ -1206,12 +1205,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "7.1.3"
|
||||
version = "8.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
|
||||
checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"minimal-lexical",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1270,12 +1268,6 @@ version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
|
||||
|
||||
[[package]]
|
||||
name = "option-ext"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
|
||||
|
||||
[[package]]
|
||||
name = "overload"
|
||||
version = "0.1.1"
|
||||
@ -1327,7 +1319,7 @@ dependencies = [
|
||||
"regex",
|
||||
"regex-syntax",
|
||||
"structmeta",
|
||||
"syn 2.0.76",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1371,7 +1363,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.76",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1503,7 +1495,16 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"regex",
|
||||
"syn 2.0.76",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1524,17 +1525,6 @@ dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_users"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"libredox",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.10.6"
|
||||
@ -1585,6 +1575,19 @@ version = "0.1.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.38.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls"
|
||||
version = "0.23.12"
|
||||
@ -1716,7 +1719,7 @@ checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.76",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1749,7 +1752,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.76",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1791,7 +1794,7 @@ dependencies = [
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.76",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1889,7 +1892,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"structmeta-derive",
|
||||
"syn 2.0.76",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1900,7 +1903,7 @@ checksum = "152a0b65a590ff6c3da95cabe2353ee04e6167c896b28e3b14478c2636c922fc"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.76",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1922,21 +1925,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.76"
|
||||
version = "2.0.87"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "578e081a14e0cefc3279b0472138c513f37b41a08d5a3cca9b6e4e8ceb6cd525"
|
||||
checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sync_wrapper"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
|
||||
|
||||
[[package]]
|
||||
name = "sync_wrapper"
|
||||
version = "1.0.1"
|
||||
@ -1945,17 +1942,17 @@ checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394"
|
||||
|
||||
[[package]]
|
||||
name = "testcontainers"
|
||||
version = "0.21.1"
|
||||
version = "0.23.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5f7d80fe0008971413157e67062150cbf508b92f0eb525b9f49de1aec4267f24"
|
||||
checksum = "5f40cc2bd72e17f328faf8ca7687fe337e61bccd8acf9674fa78dd3792b045e1"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"bollard",
|
||||
"bollard-stubs",
|
||||
"bytes",
|
||||
"dirs",
|
||||
"docker_credential",
|
||||
"either",
|
||||
"etcetera",
|
||||
"futures",
|
||||
"log",
|
||||
"memchr",
|
||||
@ -1964,57 +1961,21 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_with",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tokio-stream",
|
||||
"tokio-util",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "testcontainers"
|
||||
version = "0.22.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2ef8374cea2c164699681ecc39316c3e1d953831a7a5721e36c7736d974e15fa"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"bollard",
|
||||
"bollard-stubs",
|
||||
"bytes",
|
||||
"dirs",
|
||||
"docker_credential",
|
||||
"either",
|
||||
"futures",
|
||||
"log",
|
||||
"memchr",
|
||||
"parse-display",
|
||||
"pin-project-lite",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_with",
|
||||
"thiserror",
|
||||
"thiserror 1.0.63",
|
||||
"tokio",
|
||||
"tokio-stream",
|
||||
"tokio-tar",
|
||||
"tokio-util",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "testcontainers-modules"
|
||||
version = "0.9.0"
|
||||
version = "0.11.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "868e8e818fe37b8ed4c21ac72185206b48e8767b5ad3836d7ec0e5c9386e19a2"
|
||||
checksum = "4d43ed4e8f58424c3a2c6c56dbea6643c3c23e8666a34df13c54f0a184e6c707"
|
||||
dependencies = [
|
||||
"testcontainers 0.21.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "testcontainers-modules"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "359d9a225791e1b9f60aab01f9ae9471898b9b9904b5db192104a71e96785079"
|
||||
dependencies = [
|
||||
"testcontainers 0.22.0",
|
||||
"testcontainers",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2024,11 +1985,11 @@ dependencies = [
|
||||
"derive_more",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"diesel_async_migrations 0.14.0",
|
||||
"diesel_async_migrations",
|
||||
"dotenvy_macro",
|
||||
"lib",
|
||||
"testcontainers-modules 0.9.0",
|
||||
"thiserror",
|
||||
"testcontainers-modules",
|
||||
"thiserror 2.0.12",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
@ -2038,7 +1999,16 @@ version = "1.0.63"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
"thiserror-impl 1.0.63",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "2.0.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708"
|
||||
dependencies = [
|
||||
"thiserror-impl 2.0.12",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2049,7 +2019,18 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.76",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "2.0.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2132,7 +2113,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.76",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2183,6 +2164,21 @@ dependencies = [
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-tar"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9d5714c010ca3e5c27114c1cdeb9d14641ace49874aa5626d7149e47aedace75"
|
||||
dependencies = [
|
||||
"filetime",
|
||||
"futures-core",
|
||||
"libc",
|
||||
"redox_syscall 0.3.5",
|
||||
"tokio",
|
||||
"tokio-stream",
|
||||
"xattr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-util"
|
||||
version = "0.7.11"
|
||||
@ -2226,30 +2222,34 @@ dependencies = [
|
||||
"tokio",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tower"
|
||||
version = "0.5.0"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36b837f86b25d7c0d7988f00a54e74739be6477f2aac6201b8f429a7569991b7"
|
||||
checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"pin-project-lite",
|
||||
"sync_wrapper",
|
||||
"tokio",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tower-http"
|
||||
version = "0.5.2"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5"
|
||||
checksum = "403fa3b783d4b626a8ad51d766ab03cb6d2dbfc46b1c5d4448395e6628dc9697"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"bytes",
|
||||
"http",
|
||||
"http-body",
|
||||
"http-body-util",
|
||||
"pin-project-lite",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
@ -2288,7 +2288,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.76",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2444,7 +2444,7 @@ dependencies = [
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.76",
|
||||
"syn 2.0.87",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
@ -2466,7 +2466,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.76",
|
||||
"syn 2.0.87",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
@ -2547,6 +2547,15 @@ dependencies = [
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.59.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.48.5"
|
||||
@ -2677,6 +2686,17 @@ dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xattr"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e105d177a3871454f754b33bb0ee637ecaaac997446375fd3e5d43a2ed00c909"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"rustix",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.7.35"
|
||||
@ -2695,7 +2715,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.76",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
18
Cargo.toml
18
Cargo.toml
@ -3,14 +3,14 @@ members = ["crates/*"]
|
||||
exclude = ["examples"]
|
||||
|
||||
[workspace.package]
|
||||
edition = "2021"
|
||||
rust-version = "1.80.1"
|
||||
edition = "2024"
|
||||
rust-version = "1.85"
|
||||
authors = ["Martin Berg Alstad"]
|
||||
homepage = "emberal.github.io"
|
||||
|
||||
[package]
|
||||
name = "lib"
|
||||
version = "1.4.3"
|
||||
version = "1.5.0"
|
||||
description = "A library with utilities and helper fuctions."
|
||||
edition = { workspace = true }
|
||||
rust-version = { workspace = true }
|
||||
@ -21,9 +21,9 @@ homepage = { workspace = true }
|
||||
|
||||
[dependencies]
|
||||
# Api
|
||||
axum = { version = "0.7", optional = true, features = ["multipart"] }
|
||||
axum = { version = "0.8", optional = true, features = ["multipart"] }
|
||||
tower = { version = "0.5", optional = true }
|
||||
tower-http = { version = "0.5", optional = true, features = ["trace", "cors", "normalize-path"] }
|
||||
tower-http = { version = "0.6", optional = true, features = ["trace", "cors", "normalize-path"] }
|
||||
mime = { version = "0.3", optional = true }
|
||||
# Async
|
||||
async-trait = { workspace = true }
|
||||
@ -42,7 +42,7 @@ thiserror = { workspace = true, optional = true }
|
||||
tracing = { version = "0.1", optional = true }
|
||||
tracing-subscriber = { version = "0.3", optional = true }
|
||||
# Parsing
|
||||
nom = { version = "7.1", optional = true }
|
||||
nom = { version = "8.0", optional = true }
|
||||
# Procedural macros
|
||||
into-response-derive = { path = "crates/into_response_derive", optional = true }
|
||||
read-files = { path = "crates/read_files", optional = true }
|
||||
@ -50,7 +50,7 @@ read-files = { path = "crates/read_files", optional = true }
|
||||
serde = { version = "1.0", optional = true, features = ["derive"] }
|
||||
serde_json = { version = "1.0", optional = true }
|
||||
# Test
|
||||
testcontainers-modules = { version = "0.10", features = ["postgres"], optional = true }
|
||||
testcontainers-modules = { version = "0.11", features = ["postgres"], optional = true }
|
||||
# Time
|
||||
chrono = { version = "0.4", optional = true, features = ["serde"] }
|
||||
# Utils
|
||||
@ -65,14 +65,14 @@ diesel = "2.2"
|
||||
diesel-async = "0.5"
|
||||
deadpool-diesel = "0.6"
|
||||
# Error handling
|
||||
thiserror = "1.0"
|
||||
thiserror = "2.0"
|
||||
# Procedural macros
|
||||
syn = "2.0"
|
||||
quote = "1.0"
|
||||
deluxe = "0.5"
|
||||
proc-macro2 = "1.0"
|
||||
# Utils
|
||||
derive_more = "1.0"
|
||||
derive_more = "2.0"
|
||||
|
||||
[features]
|
||||
axum = ["dep:axum", "dep:tower", "dep:tower-http", "dep:thiserror", "dep:tracing", "dep:tracing-subscriber", "dep:tokio", "dep:mime"]
|
||||
|
@ -9,4 +9,4 @@ diesel = { workspace = true, features = ["postgres"] }
|
||||
diesel-async = { workspace = true, features = ["postgres", "deadpool"] }
|
||||
async-trait = "0.1"
|
||||
deadpool-diesel = { version = "0.6", features = ["postgres"] }
|
||||
thiserror = "1.0"
|
||||
thiserror = { workspace = true }
|
||||
|
@ -9,12 +9,12 @@ homepage.workspace = true
|
||||
[dependencies]
|
||||
diesel = { workspace = true }
|
||||
diesel-async = { workspace = true }
|
||||
lib = { path = "../../../lib", features = ["diesel", "derive"] }
|
||||
lib = { path = "../../../rust-lib", features = ["diesel", "derive"] }
|
||||
derive_more = { workspace = true, features = ["constructor", "from"] }
|
||||
thiserror = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
tokio = { workspace = true, features = ["macros"] }
|
||||
dotenvy_macro = "0.15"
|
||||
testcontainers-modules = { version = "0.9", features = ["postgres"] }
|
||||
diesel_async_migrations = "0.14"
|
||||
testcontainers-modules = { version = "0.11", features = ["postgres"] }
|
||||
diesel_async_migrations = "0.15"
|
||||
|
@ -6,4 +6,4 @@ file = "src/schema.rs"
|
||||
custom_type_derives = ["diesel::query_builder::QueryId", "Clone"]
|
||||
|
||||
[migrations_directory]
|
||||
dir = "/home/martin/git/rust/lib/crates/tests/migrations"
|
||||
dir = "./migrations"
|
||||
|
44
flake.lock
generated
Normal file
44
flake.lock
generated
Normal file
@ -0,0 +1,44 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1741196730,
|
||||
"narHash": "sha256-0Sj6ZKjCpQMfWnN0NURqRCQn2ob7YtXTAOTwCuz7fkA=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "48913d8f9127ea6530a2a2f1bd4daa1b8685d8a3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-24.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1741173522,
|
||||
"narHash": "sha256-k7VSqvv0r1r53nUI/IfPHCppkUAddeXn843YlAC5DR0=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d69ab0d71b22fa1ce3dbeff666e6deb4917db049",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
38
flake.nix
Normal file
38
flake.nix
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
};
|
||||
|
||||
outputs = { nixpkgs, nixpkgs-unstable, ... }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
in
|
||||
{
|
||||
devShells.${system}.default =
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
};
|
||||
unstable = import nixpkgs-unstable {
|
||||
inherit system;
|
||||
};
|
||||
in
|
||||
pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
git
|
||||
just
|
||||
] ++ [
|
||||
# Rust
|
||||
gcc
|
||||
# cargo
|
||||
] ++ [
|
||||
# Diesel
|
||||
diesel-cli
|
||||
unstable.libpq
|
||||
];
|
||||
|
||||
shellHook = "fish";
|
||||
};
|
||||
};
|
||||
}
|
19
justfile
Executable file
19
justfile
Executable file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env just --justfile
|
||||
|
||||
run:
|
||||
cargo run
|
||||
|
||||
fmt:
|
||||
cargo fmt
|
||||
|
||||
lint:
|
||||
cargo clippy
|
||||
|
||||
release:
|
||||
cargo build --release
|
||||
|
||||
test:
|
||||
cargo test --all-features --workspace
|
||||
|
||||
coverage:
|
||||
cargo llvm-cov
|
@ -1,7 +1,7 @@
|
||||
use {
|
||||
axum::{
|
||||
extract::Request, handler::Handler, response::IntoResponse, routing::Route, Router,
|
||||
ServiceExt,
|
||||
Router, ServiceExt, extract::Request, handler::Handler, response::IntoResponse,
|
||||
routing::Route,
|
||||
},
|
||||
std::{
|
||||
convert::Infallible,
|
||||
@ -9,14 +9,14 @@ use {
|
||||
net::{IpAddr, Ipv4Addr, SocketAddr},
|
||||
},
|
||||
tokio::net::TcpListener,
|
||||
tower::{layer::Layer, Service},
|
||||
tower::{Service, layer::Layer},
|
||||
tower_http::{
|
||||
cors::CorsLayer,
|
||||
normalize_path::NormalizePathLayer,
|
||||
trace,
|
||||
trace::{HttpMakeClassifier, TraceLayer},
|
||||
},
|
||||
tracing::{info, Level},
|
||||
tracing::{Level, info},
|
||||
};
|
||||
|
||||
// TODO trim trailing slash into macro > let _app = NormalizePathLayer::trim_trailing_slash().layer(create_app!(routes));
|
||||
@ -69,8 +69,8 @@ impl AppBuilder {
|
||||
/// Adds a layer to the previously added routes
|
||||
pub fn layer<L>(mut self, layer: L) -> Self
|
||||
where
|
||||
L: Layer<Route> + Clone + Send + 'static,
|
||||
L::Service: Service<Request> + Clone + Send + 'static,
|
||||
L: Layer<Route> + Clone + Send + Sync + 'static,
|
||||
L::Service: Service<Request> + Clone + Send + Sync + 'static,
|
||||
<L::Service as Service<Request>>::Response: IntoResponse + 'static,
|
||||
<L::Service as Service<Request>>::Error: Into<Infallible> + 'static,
|
||||
<L::Service as Service<Request>>::Future: Send + 'static,
|
||||
|
@ -1,8 +1,7 @@
|
||||
use axum::{
|
||||
async_trait,
|
||||
extract::{
|
||||
multipart::{Field, MultipartError, MultipartRejection},
|
||||
FromRequest, Multipart, Request,
|
||||
multipart::{Field, MultipartError, MultipartRejection},
|
||||
},
|
||||
response::IntoResponse,
|
||||
};
|
||||
@ -110,7 +109,6 @@ impl IntoResponse for MultipartFileRejection {
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl<S> FromRequest<S> for MultipartFile
|
||||
where
|
||||
S: Send + Sync,
|
||||
@ -142,7 +140,6 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl<S> FromRequest<S> for MultipartFiles
|
||||
where
|
||||
S: Send + Sync,
|
||||
@ -178,7 +175,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
async fn get_files<'a>(mut multipart: Multipart) -> Result<Vec<File>, MultipartFileRejection> {
|
||||
async fn get_files(mut multipart: Multipart) -> Result<Vec<File>, MultipartFileRejection> {
|
||||
let mut files = vec![];
|
||||
while let Some(field) = multipart.next_field().await? {
|
||||
files.push(File::from_field(field).await?);
|
||||
|
@ -1,8 +1,8 @@
|
||||
use axum::async_trait;
|
||||
use async_trait::async_trait;
|
||||
use deadpool_diesel::Status;
|
||||
use derive_more::From;
|
||||
use diesel_async::pooled_connection::deadpool::{Object, PoolError};
|
||||
use diesel_async::AsyncPgConnection;
|
||||
use diesel_async::pooled_connection::deadpool::{Object, PoolError};
|
||||
use lib::diesel::pool::PgPool;
|
||||
|
||||
#[async_trait]
|
||||
|
@ -1,23 +1,22 @@
|
||||
use {
|
||||
nom::{
|
||||
bytes::complete::take_while_m_n,
|
||||
character::complete::{char, multispace0},
|
||||
combinator::eof,
|
||||
sequence::{delimited, terminated},
|
||||
IResult, InputIter, InputLength, InputTake, Slice,
|
||||
},
|
||||
std::ops::RangeFrom,
|
||||
};
|
||||
|
||||
// TODO generic input
|
||||
use nom::IResult;
|
||||
use nom::bytes::complete::take_while_m_n;
|
||||
use nom::character::complete::char;
|
||||
use nom::character::complete::multispace0;
|
||||
use nom::combinator::eof;
|
||||
use nom::error::ParseError;
|
||||
use nom::sequence::delimited;
|
||||
use nom::sequence::terminated;
|
||||
use nom::{Input, Parser};
|
||||
|
||||
/// Trim leading and trailing whitespace from the input Parser
|
||||
/// - Parameters
|
||||
/// - `inner`: The parser to trim
|
||||
/// - Returns: A parser that trims leading and trailing whitespace from the input and then runs the value from the inner parser
|
||||
pub fn trim<'a, Parser, R>(inner: Parser) -> impl FnMut(&'a str) -> IResult<&'a str, R>
|
||||
pub fn trim<I, O, F, E: ParseError<I>>(inner: F) -> impl Parser<I, Output = O, Error = E>
|
||||
where
|
||||
Parser: FnMut(&'a str) -> IResult<&'a str, R>,
|
||||
I: Input,
|
||||
F: Parser<I, Output = O, Error = E>,
|
||||
<I as Input>::Item: nom::AsChar,
|
||||
{
|
||||
delimited(multispace0, inner, multispace0)
|
||||
}
|
||||
@ -27,9 +26,11 @@ where
|
||||
/// - Parameters
|
||||
/// - `inner`: The parser to run inside the parentheses
|
||||
/// - Returns: A parser that parses a parenthesized expression
|
||||
pub fn parenthesized<'a, Parser, R>(inner: Parser) -> impl FnMut(&'a str) -> IResult<&'a str, R>
|
||||
pub fn parenthesized<I, O, F, E: ParseError<I>>(inner: F) -> impl Parser<I, Output = O, Error = E>
|
||||
where
|
||||
Parser: FnMut(&'a str) -> IResult<&'a str, R>,
|
||||
I: Input,
|
||||
F: Parser<I, Output = O, Error = E>,
|
||||
<I as Input>::Item: nom::AsChar,
|
||||
{
|
||||
delimited(char('('), inner, char(')'))
|
||||
}
|
||||
@ -39,10 +40,10 @@ where
|
||||
/// - `n`: The length of the string to take
|
||||
/// - `predicate`: The predicate to call to validate the input
|
||||
/// - Returns: A parser that takes `n` characters from the input
|
||||
pub fn take_where<F, Input>(n: usize, predicate: F) -> impl Fn(Input) -> IResult<Input, Input>
|
||||
pub fn take_where<F, I>(n: usize, predicate: F) -> impl FnMut(I) -> IResult<I, I>
|
||||
where
|
||||
Input: InputTake + InputIter + InputLength + Slice<RangeFrom<usize>>,
|
||||
F: Fn(<Input as InputIter>::Item) -> bool + Copy,
|
||||
I: Input,
|
||||
F: Fn(<I as Input>::Item) -> bool,
|
||||
{
|
||||
take_while_m_n(n, n, predicate)
|
||||
}
|
||||
@ -54,40 +55,43 @@ where
|
||||
/// - Returns: A parser that runs the inner parser and then the end of the input
|
||||
/// # Example
|
||||
/// ```
|
||||
/// use nom::bytes::complete::{tag};
|
||||
/// use lib::nom::combinators::exhausted;
|
||||
/// use nom::bytes::complete::{tag};
|
||||
/// use nom::Parser;
|
||||
///
|
||||
/// let input = "test";
|
||||
/// let (remaining, result) = exhausted(tag("test"))(input).unwrap();
|
||||
/// let (remaining, result) = exhausted(tag::<&str, &str, nom::error::Error<&str>>("test")).parse(input).unwrap();
|
||||
/// assert_eq!(remaining, "");
|
||||
/// assert_eq!(result, "test");
|
||||
/// ```
|
||||
/// - Fails if the input is not exhausted
|
||||
/// ```
|
||||
/// use nom::bytes::complete::{tag};
|
||||
/// use lib::nom::combinators::exhausted;
|
||||
/// use nom::bytes::complete::{tag};
|
||||
/// use nom::Parser;
|
||||
///
|
||||
/// let input = "test";
|
||||
/// assert!(exhausted(tag("tes"))(input).is_err());
|
||||
/// assert!(exhausted(tag::<&str, &str, nom::error::Error<&str>>("tes")).parse(input).is_err());
|
||||
/// ```
|
||||
pub fn exhausted<'a, Parser, R>(inner: Parser) -> impl FnMut(&'a str) -> IResult<&'a str, R>
|
||||
pub fn exhausted<F, I, O, E: ParseError<I>>(inner: F) -> impl Parser<I, Output = O, Error = E>
|
||||
where
|
||||
Parser: FnMut(&'a str) -> IResult<&'a str, R>,
|
||||
I: Input,
|
||||
F: Parser<I, Output = O, Error = E>,
|
||||
{
|
||||
terminated(inner, eof)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use nom::{bytes::complete::take_while, sequence::tuple};
|
||||
|
||||
use super::*;
|
||||
use nom::bytes::complete::take_while;
|
||||
|
||||
#[test]
|
||||
fn test_trim_both_sides() {
|
||||
let input = " test ";
|
||||
let (remaining, result) =
|
||||
trim(take_where(4, |c: char| c.is_ascii_alphabetic()))(input).unwrap();
|
||||
let (remaining, result) = trim(take_where(4, |c: char| c.is_ascii_alphabetic()))
|
||||
.parse(input)
|
||||
.unwrap();
|
||||
assert_eq!(remaining, "");
|
||||
assert_eq!(result, "test");
|
||||
}
|
||||
@ -95,8 +99,9 @@ mod tests {
|
||||
#[test]
|
||||
fn test_trim_leading() {
|
||||
let input = " test";
|
||||
let (remaining, result) =
|
||||
trim(take_where(4, |c: char| c.is_ascii_alphabetic()))(input).unwrap();
|
||||
let (remaining, result) = trim(take_where(4, |c: char| c.is_ascii_alphabetic()))
|
||||
.parse(input)
|
||||
.unwrap();
|
||||
assert_eq!(remaining, "");
|
||||
assert_eq!(result, "test");
|
||||
}
|
||||
@ -104,8 +109,9 @@ mod tests {
|
||||
#[test]
|
||||
fn test_trim_trailing() {
|
||||
let input = "test ";
|
||||
let (remaining, result) =
|
||||
trim(take_where(4, |c: char| c.is_ascii_alphabetic()))(input).unwrap();
|
||||
let (remaining, result) = trim(take_where(4, |c: char| c.is_ascii_alphabetic()))
|
||||
.parse(input)
|
||||
.unwrap();
|
||||
assert_eq!(remaining, "");
|
||||
assert_eq!(result, "test");
|
||||
}
|
||||
@ -113,8 +119,9 @@ mod tests {
|
||||
#[test]
|
||||
fn test_trim_no_trim() {
|
||||
let input = "test";
|
||||
let (remaining, result) =
|
||||
trim(take_where(4, |c: char| c.is_ascii_alphabetic()))(input).unwrap();
|
||||
let (remaining, result) = trim(take_where(4, |c: char| c.is_ascii_alphabetic()))
|
||||
.parse(input)
|
||||
.unwrap();
|
||||
assert_eq!(remaining, "");
|
||||
assert_eq!(result, "test");
|
||||
}
|
||||
@ -122,8 +129,9 @@ mod tests {
|
||||
#[test]
|
||||
fn test_parenthesized() {
|
||||
let input = "(test)";
|
||||
let (remaining, result) =
|
||||
parenthesized(take_where(4, |c: char| c.is_ascii_alphabetic()))(input).unwrap();
|
||||
let (remaining, result) = parenthesized(take_where(4, |c: char| c.is_ascii_alphabetic()))
|
||||
.parse(input)
|
||||
.unwrap();
|
||||
assert_eq!(remaining, "");
|
||||
assert_eq!(result, "test");
|
||||
}
|
||||
@ -131,7 +139,11 @@ mod tests {
|
||||
#[test]
|
||||
fn test_parenthesized_parse_until_end() {
|
||||
let input = "(test)";
|
||||
assert!(parenthesized(take_while(|_| true))(input).is_err());
|
||||
assert!(
|
||||
parenthesized::<&str, &str, _, nom::error::Error<&str>>(take_while(|_| true))
|
||||
.parse(input)
|
||||
.is_err()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -152,7 +164,7 @@ mod tests {
|
||||
fn test_take_where_too_much() {
|
||||
let input = "testing";
|
||||
assert_eq!(
|
||||
take_where(4, |c: char| c.is_ascii_alphabetic())(input),
|
||||
take_where(4, |c: char| c.is_ascii_alphabetic()).parse(input),
|
||||
Ok(("ing", "test"))
|
||||
);
|
||||
}
|
||||
@ -160,14 +172,19 @@ mod tests {
|
||||
#[test]
|
||||
fn test_take_where_predicate_false() {
|
||||
let input = "test";
|
||||
assert!(take_where(4, |c: char| c.is_ascii_digit())(input).is_err());
|
||||
assert!(
|
||||
take_where(4, |c: char| c.is_ascii_digit())
|
||||
.parse(input)
|
||||
.is_err()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_exhausted() {
|
||||
let input = "test";
|
||||
let (remaining, result) =
|
||||
exhausted(take_where(4, |c: char| c.is_ascii_alphabetic()))(input).unwrap();
|
||||
let (remaining, result) = exhausted(take_where(4, |c: char| c.is_ascii_alphabetic()))
|
||||
.parse(input)
|
||||
.unwrap();
|
||||
assert_eq!(remaining, "");
|
||||
assert_eq!(result, "test");
|
||||
}
|
||||
@ -175,16 +192,21 @@ mod tests {
|
||||
#[test]
|
||||
fn test_exhausted_not_exhausted() {
|
||||
let input = "test ";
|
||||
assert!(exhausted(take_where(4, |c: char| c.is_ascii_alphabetic()))(input).is_err());
|
||||
assert!(
|
||||
exhausted(take_where(4, |c: char| c.is_ascii_alphabetic()))
|
||||
.parse(input)
|
||||
.is_err()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_exhausted_tuple() {
|
||||
let input = "test";
|
||||
let (remaining, result) = exhausted(tuple((
|
||||
let (remaining, result) = exhausted((
|
||||
take_where(3, |c: char| c.is_ascii_alphabetic()),
|
||||
take_while(|c: char| c.is_ascii_alphabetic()),
|
||||
)))(input)
|
||||
))
|
||||
.parse(input)
|
||||
.unwrap();
|
||||
assert_eq!(remaining, "");
|
||||
assert_eq!(result, ("tes", "t"));
|
||||
|
@ -1,9 +1,9 @@
|
||||
use crate::diesel::DieselError;
|
||||
use crate::diesel::get_connection::{GetConnection, GetConnectionError};
|
||||
use crate::diesel::pool::PgPool;
|
||||
use crate::diesel::DieselError;
|
||||
use axum::async_trait;
|
||||
use deadpool_diesel::postgres::BuildError;
|
||||
use async_trait::async_trait;
|
||||
use deadpool_diesel::Status;
|
||||
use deadpool_diesel::postgres::BuildError;
|
||||
use derive_more::From;
|
||||
use diesel_async::pooled_connection::deadpool::Object;
|
||||
use diesel_async::{AsyncConnection, AsyncPgConnection};
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::diesel::pool::{create_pool_from_url, PgPool};
|
||||
use crate::diesel::pool::{PgPool, create_pool_from_url};
|
||||
use deadpool_diesel::postgres::BuildError;
|
||||
use derive_more::{Constructor, From};
|
||||
use diesel_async::pooled_connection::deadpool::PoolError;
|
||||
@ -16,7 +16,7 @@ pub struct TestContainer {
|
||||
pub pool: PgPool,
|
||||
}
|
||||
|
||||
pub async fn create_test_containers_pool<'a>() -> Result<TestContainer, ContainerError> {
|
||||
pub async fn create_test_containers_pool() -> Result<TestContainer, ContainerError> {
|
||||
let container = create_postgres_container().await?;
|
||||
let connection_string = format!(
|
||||
"postgres://postgres:postgres@127.0.0.1:{}/postgres",
|
||||
|
Loading…
x
Reference in New Issue
Block a user