Browse Source

[xitca-web] add xitca-web-axum bench. (#8567)

* [xitca-web] add xitca-web-axum bench.

* revert to nightly toolchain.

* avoid boxing response body.
fakeshadow 1 year ago
parent
commit
38feded9a1

+ 352 - 55
frameworks/Rust/xitca-web/Cargo.lock

@@ -17,6 +17,17 @@ version = "1.0.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
 
+[[package]]
+name = "async-trait"
+version = "0.1.74"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
 [[package]]
 name = "atoi"
 version = "2.0.0"
@@ -32,6 +43,55 @@ version = "1.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
 
+[[package]]
+name = "axum"
+version = "0.6.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf"
+dependencies = [
+ "async-trait",
+ "axum-core",
+ "bitflags 1.3.2",
+ "bytes",
+ "futures-util",
+ "http",
+ "http-body",
+ "hyper",
+ "itoa",
+ "matchit",
+ "memchr",
+ "mime",
+ "percent-encoding",
+ "pin-project-lite",
+ "rustversion",
+ "serde",
+ "serde_json",
+ "serde_path_to_error",
+ "serde_urlencoded",
+ "sync_wrapper",
+ "tokio",
+ "tower",
+ "tower-layer",
+ "tower-service",
+]
+
+[[package]]
+name = "axum-core"
+version = "0.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c"
+dependencies = [
+ "async-trait",
+ "bytes",
+ "futures-util",
+ "http",
+ "http-body",
+ "mime",
+ "rustversion",
+ "tower-layer",
+ "tower-service",
+]
+
 [[package]]
 name = "backtrace"
 version = "0.3.69"
@@ -49,9 +109,9 @@ dependencies = [
 
 [[package]]
 name = "base64"
-version = "0.21.4"
+version = "0.21.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2"
+checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9"
 
 [[package]]
 name = "bitflags"
@@ -59,6 +119,12 @@ version = "1.3.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
 
+[[package]]
+name = "bitflags"
+version = "2.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
+
 [[package]]
 name = "block-buffer"
 version = "0.10.4"
@@ -97,9 +163,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
 
 [[package]]
 name = "cpufeatures"
-version = "0.2.9"
+version = "0.2.11"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1"
+checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0"
 dependencies = [
  "libc",
 ]
@@ -155,11 +221,47 @@ version = "1.0.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
 
+[[package]]
+name = "form_urlencoded"
+version = "1.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
+dependencies = [
+ "percent-encoding",
+]
+
+[[package]]
+name = "futures-channel"
+version = "0.3.29"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb"
+dependencies = [
+ "futures-core",
+]
+
 [[package]]
 name = "futures-core"
-version = "0.3.28"
+version = "0.3.29"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c"
+
+[[package]]
+name = "futures-task"
+version = "0.3.29"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c"
+checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2"
+
+[[package]]
+name = "futures-util"
+version = "0.3.29"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104"
+dependencies = [
+ "futures-core",
+ "futures-task",
+ "pin-project-lite",
+ "pin-utils",
+]
 
 [[package]]
 name = "generic-array"
@@ -173,9 +275,9 @@ dependencies = [
 
 [[package]]
 name = "getrandom"
-version = "0.2.10"
+version = "0.2.11"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
+checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f"
 dependencies = [
  "cfg-if",
  "libc",
@@ -184,9 +286,9 @@ dependencies = [
 
 [[package]]
 name = "gimli"
-version = "0.28.0"
+version = "0.28.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0"
+checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
 
 [[package]]
 name = "hermit-abi"
@@ -214,15 +316,32 @@ dependencies = [
 
 [[package]]
 name = "http"
-version = "0.2.9"
+version = "0.2.11"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482"
+checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb"
 dependencies = [
  "bytes",
  "fnv",
  "itoa",
 ]
 
+[[package]]
+name = "http-body"
+version = "0.4.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1"
+dependencies = [
+ "bytes",
+ "http",
+ "pin-project-lite",
+]
+
+[[package]]
+name = "http-range-header"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f"
+
 [[package]]
 name = "httparse"
 version = "1.8.0"
@@ -235,13 +354,36 @@ version = "1.0.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
 
+[[package]]
+name = "hyper"
+version = "0.14.27"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468"
+dependencies = [
+ "bytes",
+ "futures-channel",
+ "futures-core",
+ "futures-util",
+ "http",
+ "http-body",
+ "httparse",
+ "httpdate",
+ "itoa",
+ "pin-project-lite",
+ "socket2 0.4.10",
+ "tokio",
+ "tower-service",
+ "tracing",
+ "want",
+]
+
 [[package]]
 name = "io-uring"
 version = "0.5.13"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "dd1e1a01cfb924fd8c5c43b6827965db394f5a3a16c599ce03452266e1cf984c"
 dependencies = [
- "bitflags",
+ "bitflags 1.3.2",
  "libc",
 ]
 
@@ -259,9 +401,9 @@ checksum = "9028f49264629065d057f340a86acb84867925865f73bbf8d47b4d149a7e88b8"
 
 [[package]]
 name = "libc"
-version = "0.2.149"
+version = "0.2.150"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b"
+checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
 
 [[package]]
 name = "libmimalloc-sys"
@@ -273,6 +415,18 @@ dependencies = [
  "libc",
 ]
 
+[[package]]
+name = "log"
+version = "0.4.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
+
+[[package]]
+name = "matchit"
+version = "0.7.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94"
+
 [[package]]
 name = "md-5"
 version = "0.10.6"
@@ -298,6 +452,12 @@ dependencies = [
  "libmimalloc-sys",
 ]
 
+[[package]]
+name = "mime"
+version = "0.3.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
+
 [[package]]
 name = "miniz_oxide"
 version = "0.7.1"
@@ -309,8 +469,8 @@ dependencies = [
 
 [[package]]
 name = "mio"
-version = "0.8.8"
-source = "git+https://github.com/fakeshadow/mio.git?rev=eb67f6794edba8bc2e973ddef32e066b41ff812a#eb67f6794edba8bc2e973ddef32e066b41ff812a"
+version = "0.8.9"
+source = "git+https://github.com/fakeshadow/mio.git?rev=52b72d372bfe5807755b7f5e3e1edf282954d6ba#52b72d372bfe5807755b7f5e3e1edf282954d6ba"
 dependencies = [
  "libc",
  "wasi",
@@ -351,11 +511,37 @@ dependencies = [
  "memchr",
 ]
 
+[[package]]
+name = "once_cell"
+version = "1.18.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
+
 [[package]]
 name = "percent-encoding"
-version = "2.3.0"
+version = "2.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
+
+[[package]]
+name = "pin-project"
+version = "1.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422"
+dependencies = [
+ "pin-project-internal",
+]
+
+[[package]]
+name = "pin-project-internal"
+version = "1.1.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
+checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
 
 [[package]]
 name = "pin-project-lite"
@@ -363,6 +549,12 @@ version = "0.2.13"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
 
+[[package]]
+name = "pin-utils"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
+
 [[package]]
 name = "postgres-protocol"
 version = "0.6.6"
@@ -400,9 +592,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
 
 [[package]]
 name = "proc-macro2"
-version = "1.0.69"
+version = "1.0.70"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da"
+checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b"
 dependencies = [
  "unicode-ident",
 ]
@@ -452,7 +644,7 @@ version = "0.3.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
 dependencies = [
- "bitflags",
+ "bitflags 1.3.2",
 ]
 
 [[package]]
@@ -461,6 +653,12 @@ version = "0.1.23"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
 
+[[package]]
+name = "rustversion"
+version = "1.0.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4"
+
 [[package]]
 name = "ryu"
 version = "1.0.15"
@@ -469,9 +667,9 @@ checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
 
 [[package]]
 name = "sailfish"
-version = "0.8.1"
+version = "0.8.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7861181faa2e413410444757deca246c70959cee725fbfd8f736a94a660eb377"
+checksum = "acd5f4680149b62b3478f6af08a8f1c37794bc1bc577e28874a4d0c70084d600"
 dependencies = [
  "itoap",
  "ryu",
@@ -481,9 +679,9 @@ dependencies = [
 
 [[package]]
 name = "sailfish-compiler"
-version = "0.8.1"
+version = "0.8.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7c38d77ced03b393e820ac70109857bd857f93e746f5d7d631829c9ee2e4f3fa"
+checksum = "67087aca4a3886686a88cee6835089c53e6143a0b8c5be01e63e4fe2f6dfe7cb"
 dependencies = [
  "filetime",
  "home",
@@ -495,9 +693,9 @@ dependencies = [
 
 [[package]]
 name = "sailfish-macros"
-version = "0.8.1"
+version = "0.8.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c8f73db14456f861a5c89166ab6ac76afd94b4d2a9416638ae2952ae051089c5"
+checksum = "e47e31910c5f9230e99992568d05a5968fe4f42a635c3f912c993e9f66a619a5"
 dependencies = [
  "proc-macro2",
  "sailfish-compiler",
@@ -511,18 +709,18 @@ checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
 
 [[package]]
 name = "serde"
-version = "1.0.189"
+version = "1.0.193"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537"
+checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89"
 dependencies = [
  "serde_derive",
 ]
 
 [[package]]
 name = "serde_derive"
-version = "1.0.189"
+version = "1.0.193"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5"
+checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -531,10 +729,32 @@ dependencies = [
 
 [[package]]
 name = "serde_json"
-version = "1.0.107"
+version = "1.0.108"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b"
+dependencies = [
+ "itoa",
+ "ryu",
+ "serde",
+]
+
+[[package]]
+name = "serde_path_to_error"
+version = "0.1.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4beec8bce849d58d06238cb50db2e1c417cfeafa4c63f692b15c82b7c80f8335"
+dependencies = [
+ "itoa",
+ "serde",
+]
+
+[[package]]
+name = "serde_urlencoded"
+version = "0.7.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65"
+checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
 dependencies = [
+ "form_urlencoded",
  "itoa",
  "ryu",
  "serde",
@@ -571,9 +791,9 @@ dependencies = [
 
 [[package]]
 name = "socket2"
-version = "0.4.9"
+version = "0.4.10"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662"
+checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d"
 dependencies = [
  "libc",
  "winapi",
@@ -581,9 +801,9 @@ dependencies = [
 
 [[package]]
 name = "socket2"
-version = "0.5.4"
+version = "0.5.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e"
+checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9"
 dependencies = [
  "libc",
  "windows-sys",
@@ -608,15 +828,21 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
 
 [[package]]
 name = "syn"
-version = "2.0.38"
+version = "2.0.39"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b"
+checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a"
 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 = "tinyvec"
 version = "1.6.0"
@@ -634,9 +860,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
 
 [[package]]
 name = "tokio"
-version = "1.33.0"
+version = "1.34.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653"
+checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9"
 dependencies = [
  "backtrace",
  "libc",
@@ -644,7 +870,7 @@ dependencies = [
  "num_cpus",
  "pin-project-lite",
  "signal-hook-registry",
- "socket2 0.5.4",
+ "socket2 0.5.5",
  "windows-sys",
 ]
 
@@ -659,16 +885,63 @@ dependencies = [
  "libc",
  "scoped-tls",
  "slab",
- "socket2 0.4.9",
+ "socket2 0.4.10",
  "tokio",
 ]
 
+[[package]]
+name = "tower"
+version = "0.4.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c"
+dependencies = [
+ "futures-core",
+ "futures-util",
+ "pin-project",
+ "pin-project-lite",
+ "tokio",
+ "tower-layer",
+ "tower-service",
+ "tracing",
+]
+
+[[package]]
+name = "tower-http"
+version = "0.4.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140"
+dependencies = [
+ "bitflags 2.4.1",
+ "bytes",
+ "futures-core",
+ "futures-util",
+ "http",
+ "http-body",
+ "http-range-header",
+ "pin-project-lite",
+ "tower-layer",
+ "tower-service",
+]
+
+[[package]]
+name = "tower-layer"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0"
+
+[[package]]
+name = "tower-service"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52"
+
 [[package]]
 name = "tracing"
 version = "0.1.40"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
 dependencies = [
+ "log",
  "pin-project-lite",
  "tracing-core",
 ]
@@ -678,6 +951,15 @@ name = "tracing-core"
 version = "0.1.32"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54"
+dependencies = [
+ "once_cell",
+]
+
+[[package]]
+name = "try-lock"
+version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed"
 
 [[package]]
 name = "typenum"
@@ -712,6 +994,15 @@ version = "0.9.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
 
+[[package]]
+name = "want"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
+dependencies = [
+ "try-lock",
+]
+
 [[package]]
 name = "wasi"
 version = "0.11.0+wasi-snapshot-preview1"
@@ -809,7 +1100,7 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
 [[package]]
 name = "xitca-http"
 version = "0.1.0"
-source = "git+https://github.com/HFQR/xitca-web.git?rev=c0b85dfef6cb7917c36b8422de28a0beaaf4404a#c0b85dfef6cb7917c36b8422de28a0beaaf4404a"
+source = "git+https://github.com/HFQR/xitca-web.git?rev=23ad63cbb3a853a548bd447cc59625a5d7c5833e#23ad63cbb3a853a548bd447cc59625a5d7c5833e"
 dependencies = [
  "futures-core",
  "http",
@@ -817,7 +1108,7 @@ dependencies = [
  "httpdate",
  "itoa",
  "pin-project-lite",
- "socket2 0.5.4",
+ "socket2 0.5.5",
  "tokio",
  "tokio-uring",
  "tracing",
@@ -830,7 +1121,7 @@ dependencies = [
 [[package]]
 name = "xitca-io"
 version = "0.1.0"
-source = "git+https://github.com/HFQR/xitca-web.git?rev=c0b85dfef6cb7917c36b8422de28a0beaaf4404a#c0b85dfef6cb7917c36b8422de28a0beaaf4404a"
+source = "git+https://github.com/HFQR/xitca-web.git?rev=23ad63cbb3a853a548bd447cc59625a5d7c5833e#23ad63cbb3a853a548bd447cc59625a5d7c5833e"
 dependencies = [
  "bytes",
  "tokio",
@@ -841,7 +1132,7 @@ dependencies = [
 [[package]]
 name = "xitca-postgres"
 version = "0.1.0"
-source = "git+https://github.com/HFQR/xitca-web.git?rev=c0b85dfef6cb7917c36b8422de28a0beaaf4404a#c0b85dfef6cb7917c36b8422de28a0beaaf4404a"
+source = "git+https://github.com/HFQR/xitca-web.git?rev=23ad63cbb3a853a548bd447cc59625a5d7c5833e#23ad63cbb3a853a548bd447cc59625a5d7c5833e"
 dependencies = [
  "fallible-iterator",
  "percent-encoding",
@@ -857,7 +1148,7 @@ dependencies = [
 [[package]]
 name = "xitca-router"
 version = "0.1.0"
-source = "git+https://github.com/HFQR/xitca-web.git?rev=c0b85dfef6cb7917c36b8422de28a0beaaf4404a#c0b85dfef6cb7917c36b8422de28a0beaaf4404a"
+source = "git+https://github.com/HFQR/xitca-web.git?rev=23ad63cbb3a853a548bd447cc59625a5d7c5833e#23ad63cbb3a853a548bd447cc59625a5d7c5833e"
 dependencies = [
  "xitca-unsafe-collection",
 ]
@@ -865,9 +1156,9 @@ dependencies = [
 [[package]]
 name = "xitca-server"
 version = "0.1.0"
-source = "git+https://github.com/HFQR/xitca-web.git?rev=c0b85dfef6cb7917c36b8422de28a0beaaf4404a#c0b85dfef6cb7917c36b8422de28a0beaaf4404a"
+source = "git+https://github.com/HFQR/xitca-web.git?rev=23ad63cbb3a853a548bd447cc59625a5d7c5833e#23ad63cbb3a853a548bd447cc59625a5d7c5833e"
 dependencies = [
- "socket2 0.5.4",
+ "socket2 0.5.5",
  "tokio",
  "tokio-uring",
  "tracing",
@@ -879,12 +1170,12 @@ dependencies = [
 [[package]]
 name = "xitca-service"
 version = "0.1.0"
-source = "git+https://github.com/HFQR/xitca-web.git?rev=c0b85dfef6cb7917c36b8422de28a0beaaf4404a#c0b85dfef6cb7917c36b8422de28a0beaaf4404a"
+source = "git+https://github.com/HFQR/xitca-web.git?rev=23ad63cbb3a853a548bd447cc59625a5d7c5833e#23ad63cbb3a853a548bd447cc59625a5d7c5833e"
 
 [[package]]
 name = "xitca-unsafe-collection"
 version = "0.1.0"
-source = "git+https://github.com/HFQR/xitca-web.git?rev=c0b85dfef6cb7917c36b8422de28a0beaaf4404a#c0b85dfef6cb7917c36b8422de28a0beaaf4404a"
+source = "git+https://github.com/HFQR/xitca-web.git?rev=23ad63cbb3a853a548bd447cc59625a5d7c5833e#23ad63cbb3a853a548bd447cc59625a5d7c5833e"
 dependencies = [
  "bytes",
 ]
@@ -894,31 +1185,37 @@ name = "xitca-web"
 version = "0.1.0"
 dependencies = [
  "atoi",
+ "axum",
  "futures-core",
+ "http-body",
  "mimalloc",
  "nanorand",
+ "pin-project-lite",
  "sailfish",
  "serde",
  "serde_json",
  "tokio",
+ "tower",
+ "tower-http",
  "xitca-http",
  "xitca-io",
  "xitca-postgres",
  "xitca-server",
  "xitca-service",
  "xitca-unsafe-collection",
- "xitca-web 0.1.0 (git+https://github.com/HFQR/xitca-web.git?rev=c0b85dfef6cb7917c36b8422de28a0beaaf4404a)",
+ "xitca-web 0.1.0 (git+https://github.com/HFQR/xitca-web.git?rev=23ad63cbb3a853a548bd447cc59625a5d7c5833e)",
 ]
 
 [[package]]
 name = "xitca-web"
 version = "0.1.0"
-source = "git+https://github.com/HFQR/xitca-web.git?rev=c0b85dfef6cb7917c36b8422de28a0beaaf4404a#c0b85dfef6cb7917c36b8422de28a0beaaf4404a"
+source = "git+https://github.com/HFQR/xitca-web.git?rev=23ad63cbb3a853a548bd447cc59625a5d7c5833e#23ad63cbb3a853a548bd447cc59625a5d7c5833e"
 dependencies = [
  "futures-core",
  "pin-project-lite",
  "serde",
  "serde_json",
+ "tokio",
  "xitca-http",
  "xitca-server",
  "xitca-service",

+ 23 - 9
frameworks/Rust/xitca-web/Cargo.toml

@@ -18,6 +18,11 @@ name = "xitca-web-wasm"
 path = "./src/main_wasm.rs"
 required-features = ["web"]
 
+[[bin]]
+name = "xitca-web-axum"
+path = "./src/main_axum.rs"
+required-features = ["axum", "io-uring"]
+
 [features]
 # pg optional
 pg = ["xitca-postgres"]
@@ -31,6 +36,8 @@ web = ["xitca-web"]
 template = ["sailfish"]
 # io-uring optional
 io-uring = ["xitca-http/io-uring", "xitca-server/io-uring"]
+# axum optional
+axum = ["dep:axum", "http-body", "pin-project-lite", "tower", "tower-http"]
 
 [dependencies]
 xitca-http = "0.1"
@@ -52,6 +59,13 @@ xitca-postgres = { version = "0.1", features = ["single-thread"], optional = tru
 # template optional
 sailfish = { version = "0.8", default-features = false, features = ["derive", "perf-inline"], optional = true }
 
+# axum optional
+axum = { version = "0.6", optional = true }
+http-body = { version = "0.4", optional = true }
+pin-project-lite = { version = "0.2", optional = true }
+tower = { version = "0.4", optional = true }
+tower-http = { version = "0.4", features = ["set-header"], optional = true }
+
 # stuff can not be used or not needed in wasi target
 [target.'cfg(not(target_family = "wasm"))'.dependencies]
 futures-core = { version = "0.3", default-features = false }
@@ -66,13 +80,13 @@ codegen-units = 1
 panic = "abort"
 
 [patch.crates-io]
-xitca-http = { git = "https://github.com/HFQR/xitca-web.git", rev = "c0b85dfef6cb7917c36b8422de28a0beaaf4404a" }
-xitca-io = { git = "https://github.com/HFQR/xitca-web.git", rev = "c0b85dfef6cb7917c36b8422de28a0beaaf4404a" }
-xitca-postgres = { git = "https://github.com/HFQR/xitca-web.git", rev = "c0b85dfef6cb7917c36b8422de28a0beaaf4404a" }
-xitca-router = { git = "https://github.com/HFQR/xitca-web.git", rev = "c0b85dfef6cb7917c36b8422de28a0beaaf4404a" }
-xitca-server = { git = "https://github.com/HFQR/xitca-web.git", rev = "c0b85dfef6cb7917c36b8422de28a0beaaf4404a" }
-xitca-service = { git = "https://github.com/HFQR/xitca-web.git", rev = "c0b85dfef6cb7917c36b8422de28a0beaaf4404a" }
-xitca-unsafe-collection = { git = "https://github.com/HFQR/xitca-web.git", rev = "c0b85dfef6cb7917c36b8422de28a0beaaf4404a" }
-xitca-web = { git = "https://github.com/HFQR/xitca-web.git", rev = "c0b85dfef6cb7917c36b8422de28a0beaaf4404a" }
+xitca-http = { git = "https://github.com/HFQR/xitca-web.git", rev = "23ad63cbb3a853a548bd447cc59625a5d7c5833e" }
+xitca-io = { git = "https://github.com/HFQR/xitca-web.git", rev = "23ad63cbb3a853a548bd447cc59625a5d7c5833e" }
+xitca-postgres = { git = "https://github.com/HFQR/xitca-web.git", rev = "23ad63cbb3a853a548bd447cc59625a5d7c5833e" }
+xitca-router = { git = "https://github.com/HFQR/xitca-web.git", rev = "23ad63cbb3a853a548bd447cc59625a5d7c5833e" }
+xitca-server = { git = "https://github.com/HFQR/xitca-web.git", rev = "23ad63cbb3a853a548bd447cc59625a5d7c5833e" }
+xitca-service = { git = "https://github.com/HFQR/xitca-web.git", rev = "23ad63cbb3a853a548bd447cc59625a5d7c5833e" }
+xitca-unsafe-collection = { git = "https://github.com/HFQR/xitca-web.git", rev = "23ad63cbb3a853a548bd447cc59625a5d7c5833e" }
+xitca-web = { git = "https://github.com/HFQR/xitca-web.git", rev = "23ad63cbb3a853a548bd447cc59625a5d7c5833e" }
 
-mio = { git = "https://github.com/fakeshadow/mio.git", rev = "eb67f6794edba8bc2e973ddef32e066b41ff812a" }
+mio = { git = "https://github.com/fakeshadow/mio.git", rev = "52b72d372bfe5807755b7f5e3e1edf282954d6ba" }

+ 18 - 0
frameworks/Rust/xitca-web/benchmark_config.json

@@ -63,6 +63,24 @@
         "display_name": "xitca-web [wasm]",
         "notes": "",
         "versus": ""
+      },
+      "axum": {
+        "json_url": "/json",
+        "plaintext_url": "/plaintext",
+        "port": 8080,
+        "approach": "Realistic",
+        "classification": "Micro",
+        "database": "none",
+        "framework": "axum [xitca]",
+        "language": "rust",
+        "orm": "raw",
+        "platform": "none",
+        "webserver": "xitca-server",
+        "os": "linux",
+        "database_os": "linux",
+        "display_name": "axum [xitca]",
+        "notes": "",
+        "versus": ""
       }
     }
   ]

+ 1 - 1
frameworks/Rust/xitca-web/rust-toolchain.toml

@@ -1,2 +1,2 @@
 [toolchain]
-channel = "nightly-2023-10-19"
+channel = "nightly-2023-11-24"

+ 16 - 23
frameworks/Rust/xitca-web/src/main.rs

@@ -8,7 +8,6 @@ mod util;
 use xitca_http::{
     body::Once,
     bytes::Bytes,
-    config::HttpServiceConfig,
     h1::RequestBody,
     http::{
         self,
@@ -31,23 +30,19 @@ type Request = http::Request<RequestExt<RequestBody>>;
 type Ctx<'a> = self::util::Ctx<'a, Request>;
 
 fn main() -> std::io::Result<()> {
+    let service = Router::new()
+        .insert("/plaintext", get(fn_service(plain_text)))
+        .insert("/json", get(fn_service(json)))
+        .insert("/db", get(fn_service(db)))
+        .insert("/fortunes", get(fn_service(fortunes)))
+        .insert("/queries", get(fn_service(queries)))
+        .insert("/updates", get(fn_service(updates)))
+        .enclosed_fn(middleware_fn)
+        .enclosed(context_mw())
+        .enclosed(HttpServiceBuilder::h1().io_uring());
+
     xitca_server::Builder::new()
-        .bind("xitca-web", "0.0.0.0:8080", || {
-            Router::new()
-                .insert("/plaintext", get(fn_service(plain_text)))
-                .insert("/json", get(fn_service(json)))
-                .insert("/db", get(fn_service(db)))
-                .insert("/fortunes", get(fn_service(fortunes)))
-                .insert("/queries", get(fn_service(queries)))
-                .insert("/updates", get(fn_service(updates)))
-                .enclosed_fn(middleware_fn)
-                .enclosed(context_mw())
-                .enclosed(
-                    HttpServiceBuilder::h1()
-                        .io_uring()
-                        .config(HttpServiceConfig::new().max_request_headers::<8>()),
-                )
-        })?
+        .bind("xitca-web", "0.0.0.0:8080", service)?
         .build()
         .wait()
 }
@@ -57,17 +52,15 @@ where
     S: for<'c> Service<Ctx<'c>, Response = Response, Error = E>,
 {
     service.call(req).await.map(|mut res| {
-        res.headers_mut().append(SERVER, SERVER_HEADER_VALUE);
+        res.headers_mut().insert(SERVER, SERVER_HEADER_VALUE);
         res
     })
 }
 
-const HELLO: Bytes = Bytes::from_static(b"Hello, World!");
-
 async fn plain_text(ctx: Ctx<'_>) -> HandleResult<Response> {
     let (req, _) = ctx.into_parts();
-    let mut res = req.into_response(HELLO);
-    res.headers_mut().append(CONTENT_TYPE, TEXT);
+    let mut res = req.into_response(Bytes::from_static(b"Hello, World!"));
+    res.headers_mut().insert(CONTENT_TYPE, TEXT);
     Ok(res)
 }
 
@@ -87,7 +80,7 @@ async fn fortunes(ctx: Ctx<'_>) -> HandleResult<Response> {
     use sailfish::TemplateOnce;
     let fortunes = state.client.tell_fortune().await?.render_once()?;
     let mut res = req.into_response(Bytes::from(fortunes));
-    res.headers_mut().append(CONTENT_TYPE, TEXT_HTML_UTF8);
+    res.headers_mut().insert(CONTENT_TYPE, TEXT_HTML_UTF8);
     Ok(res)
 }
 

+ 189 - 0
frameworks/Rust/xitca-web/src/main_axum.rs

@@ -0,0 +1,189 @@
+//! show case of axum running on proper thread per core server with io-uring enabled.
+
+#[global_allocator]
+static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
+
+mod ser;
+mod util;
+
+use axum::{
+    http::header::{HeaderValue, SERVER},
+    response::IntoResponse,
+    routing::{get, Router},
+    Json,
+};
+use tower_http::set_header::SetResponseHeaderLayer;
+
+use crate::tower_compat::TowerHttp;
+
+fn main() -> std::io::Result<()> {
+    let service = TowerHttp::service(|| async {
+        Router::new()
+            .route("/plaintext", get(plain_text))
+            .route("/json", get(json))
+            .layer(SetResponseHeaderLayer::if_not_present(
+                SERVER,
+                HeaderValue::from_static("A"),
+            ))
+    });
+
+    xitca_server::Builder::new()
+        .bind("xitca-axum", "0.0.0.0:8080", service)?
+        .build()
+        .wait()
+}
+
+async fn plain_text() -> &'static str {
+    "Hello, World!"
+}
+
+async fn json() -> impl IntoResponse {
+    Json(ser::Message::new())
+}
+
+mod tower_compat {
+    use std::{
+        cell::RefCell,
+        convert::Infallible,
+        error, fmt,
+        future::Future,
+        io,
+        marker::PhantomData,
+        net::SocketAddr,
+        pin::Pin,
+        task::{Context, Poll},
+    };
+
+    use axum::extract::ConnectInfo;
+    use futures_core::stream::Stream;
+    use http_body::Body;
+    use pin_project_lite::pin_project;
+    use xitca_http::{
+        body::none_body_hint,
+        bytes::Bytes,
+        h1::RequestBody,
+        http::{HeaderMap, Request, RequestExt, Response},
+        BodyError, HttpServiceBuilder,
+    };
+    use xitca_io::net::io_uring::TcpStream;
+    use xitca_service::{
+        fn_build, middleware::UncheckedReady, ready::ReadyService, Service, ServiceExt,
+    };
+    use xitca_unsafe_collection::fake_send_sync::FakeSend;
+
+    pub struct TowerHttp<S, B> {
+        service: RefCell<S>,
+        _p: PhantomData<fn(B)>,
+    }
+
+    impl<S, B> TowerHttp<S, B> {
+        pub fn service<F, Fut>(
+            service: F,
+        ) -> impl Service<
+            Response = impl ReadyService + Service<(TcpStream, SocketAddr)>,
+            Error = impl fmt::Debug,
+        >
+        where
+            F: Fn() -> Fut + Send + Sync + Clone,
+            Fut: Future<Output = S>,
+            S: tower::Service<Request<_RequestBody>, Response = Response<B>>,
+            S::Error: fmt::Debug,
+            B: Body<Data = Bytes> + Send + 'static,
+            B::Error: error::Error + Send + Sync,
+        {
+            fn_build(move |_| {
+                let service = service.clone();
+                async move {
+                    let service = service().await;
+                    Ok::<_, Infallible>(TowerHttp {
+                        service: RefCell::new(service),
+                        _p: PhantomData,
+                    })
+                }
+            })
+            .enclosed(UncheckedReady)
+            .enclosed(HttpServiceBuilder::h1().io_uring())
+        }
+    }
+
+    impl<S, B> Service<Request<RequestExt<RequestBody>>> for TowerHttp<S, B>
+    where
+        S: tower::Service<Request<_RequestBody>, Response = Response<B>>,
+        B: Body<Data = Bytes> + Send + 'static,
+        B::Error: error::Error + Send + Sync,
+    {
+        type Response = Response<ResponseBody<B>>;
+        type Error = S::Error;
+
+        async fn call(
+            &self,
+            req: Request<RequestExt<RequestBody>>,
+        ) -> Result<Self::Response, Self::Error> {
+            let (parts, ext) = req.into_parts();
+            let (ext, body) = ext.replace_body(());
+            let body = _RequestBody {
+                body: FakeSend::new(body),
+            };
+            let mut req = Request::from_parts(parts, body);
+            let _ = req.extensions_mut().insert(ConnectInfo(*ext.socket_addr()));
+            let fut = self.service.borrow_mut().call(req);
+            let (parts, body) = fut.await?.into_parts();
+            let body = ResponseBody { body };
+            let res = Response::from_parts(parts, body);
+            Ok(res)
+        }
+    }
+
+    pub struct _RequestBody {
+        body: FakeSend<RequestBody>,
+    }
+
+    impl Body for _RequestBody {
+        type Data = Bytes;
+        type Error = io::Error;
+
+        fn poll_data(
+            self: Pin<&mut Self>,
+            cx: &mut Context<'_>,
+        ) -> Poll<Option<Result<Self::Data, Self::Error>>> {
+            Pin::new(&mut *self.get_mut().body).poll_next(cx)
+        }
+
+        fn poll_trailers(
+            self: Pin<&mut Self>,
+            _: &mut Context<'_>,
+        ) -> Poll<Result<Option<HeaderMap>, Self::Error>> {
+            Poll::Ready(Ok(None))
+        }
+    }
+
+    pin_project! {
+        pub struct ResponseBody<B> {
+            #[pin]
+            body: B
+        }
+    }
+
+    impl<B> Stream for ResponseBody<B>
+    where
+        B: Body<Data = Bytes>,
+        B::Error: error::Error + Send + Sync + 'static,
+    {
+        type Item = Result<Bytes, BodyError>;
+
+        fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
+            self.project()
+                .body
+                .poll_data(cx)
+                .map_err(|e| BodyError::from(Box::new(e) as Box<dyn error::Error + Send + Sync>))
+        }
+
+        fn size_hint(&self) -> (usize, Option<usize>) {
+            if Body::is_end_stream(&self.body) {
+                return none_body_hint();
+            }
+            let hint = Body::size_hint(&self.body);
+            (hint.lower() as _, hint.upper().map(|u| u as _))
+        }
+    }
+}

+ 10 - 11
frameworks/Rust/xitca-web/src/main_iou.rs

@@ -38,18 +38,17 @@ type Request = http::Request<RequestExt<()>>;
 type Response = http::Response<Once<Bytes>>;
 
 fn main() -> io::Result<()> {
+    let service = fn_service(handler)
+        .enclosed(context_mw())
+        .enclosed(fn_build(|service| async {
+            Ok::<_, Infallible>(Http1IOU {
+                service,
+                date: DateTimeService::new(),
+            })
+        }))
+        .enclosed(UncheckedReady);
     xitca_server::Builder::new()
-        .bind("xitca-iou", "0.0.0.0:8080", || {
-            fn_service(handler)
-                .enclosed(context_mw())
-                .enclosed(fn_build(|service| async {
-                    Ok::<_, Infallible>(Http1IOU {
-                        service,
-                        date: DateTimeService::new(),
-                    })
-                }))
-                .enclosed(UncheckedReady)
-        })?
+        .bind("xitca-iou", "0.0.0.0:8080", service)?
         .build()
         .wait()
 }

+ 15 - 19
frameworks/Rust/xitca-web/src/main_wasm.rs

@@ -10,7 +10,7 @@ use xitca_web::{
     request::WebRequest,
     response::WebResponse,
     route::get,
-    App, HttpServer,
+    App,
 };
 
 use self::util::SERVER_HEADER_VALUE;
@@ -23,24 +23,20 @@ fn main() -> io::Result<()> {
 
     let listener = unsafe { TcpListener::from_raw_fd(fd) };
 
-    HttpServer::new(|| {
-        App::new()
-            .at(
-                "/json",
-                get(handler_service(|| async {
-                    Json::<ser::Message>(ser::Message::new())
-                })),
-            )
-            .at(
-                "/plaintext",
-                get(handler_service(|| async { "Hello, World!" })),
-            )
-            .enclosed_fn(middleware_fn)
-            .finish()
-    })
-    .listen(listener)?
-    .run()
-    .wait()
+    App::new()
+        .at(
+            "/json",
+            get(handler_service(|| async { Json(ser::Message::new()) })),
+        )
+        .at(
+            "/plaintext",
+            get(handler_service(|| async { "Hello, World!" })),
+        )
+        .enclosed_fn(middleware_fn)
+        .serve()
+        .listen(listener)?
+        .run()
+        .wait()
 }
 
 async fn middleware_fn<S, E>(service: &S, ctx: WebRequest<'_>) -> Result<WebResponse, E>

+ 2 - 0
frameworks/Rust/xitca-web/src/util.rs

@@ -30,6 +30,7 @@ pub type Error = Box<dyn std::error::Error + Send + Sync + 'static>;
 pub type HandleResult<T> = Result<T, Error>;
 
 #[cfg(not(target_arch = "wasm32"))]
+#[cfg(any(feature = "pg", feature = "pg-iou"))]
 mod non_wasm {
     use core::{cell::RefCell, future::Future, pin::Pin};
 
@@ -76,4 +77,5 @@ mod non_wasm {
 }
 
 #[cfg(not(target_arch = "wasm32"))]
+#[cfg(any(feature = "pg", feature = "pg-iou"))]
 pub use non_wasm::*;

+ 10 - 0
frameworks/Rust/xitca-web/xitca-web-axum.dockerfile

@@ -0,0 +1,10 @@
+FROM rust:1.74
+
+ADD ./ /xitca-web
+WORKDIR /xitca-web
+
+RUN cargo build --release --bin xitca-web-axum --features axum,io-uring
+
+EXPOSE 8080
+
+CMD ./target/release/xitca-web-axum

+ 6 - 7
frameworks/Rust/xitca-web/xitca-web-wasm.dockerfile

@@ -1,7 +1,7 @@
-ARG WASMTIME_VERSION=12.0.1
+ARG WASMTIME_VERSION=15.0.0
 ARG WASM_TARGET=wasm32-wasi-preview1-threads
 
-FROM rust:1.67 AS compile
+FROM rust:1.74 AS compile
 
 ARG WASMTIME_VERSION
 ARG WASM_TARGET
@@ -27,9 +27,8 @@ COPY --from=compile \
 /opt/xitca-web-wasm/
 EXPOSE 8080
 
-CMD /opt/xitca-web-wasm/wasmtime run /opt/xitca-web-wasm/xitca-web-wasm.wasm \
---wasm-features=threads \
---wasi-modules experimental-wasi-threads \
---allow-precompiled \
+CMD /opt/xitca-web-wasm/wasmtime run \
+--wasm all-proposals=y \
+--wasi threads=y,tcplisten=0.0.0.0:8080 \
 --env FD_COUNT=3 \
---tcplisten 0.0.0.0:8080
+/opt/xitca-web-wasm/xitca-web-wasm.wasm