diff --git a/Cargo.lock b/Cargo.lock index 1b7ae2d9..a0b8baff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -135,9 +135,9 @@ checksum = "03918c3dbd7701a85c6b9887732e2921175f26c350b4563841d0958c21d57e6d" [[package]] name = "asn1-rs" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56624a96882bb8c26d61312ae18cb45868e5a9992ea73c58e45c3101e56a1e60" +checksum = "b7f43a50ac4fdca5df8e885c21b835997f0a1cdee65494a6847694a98652d9d8" dependencies = [ "asn1-rs-derive", "asn1-rs-impl", @@ -363,7 +363,7 @@ dependencies = [ "cap-primitives", "cap-std", "io-lifetimes", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -392,7 +392,7 @@ dependencies = [ "maybe-owned", "rustix 1.1.4", "rustix-linux-procfs", - "windows-sys 0.52.0", + "windows-sys 0.59.0", "winx", ] @@ -440,9 +440,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.2.61" +version = "1.2.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d16d90359e986641506914ba71350897565610e87ce0ad9e6f28569db3dd5c6d" +checksum = "a1dce859f0832a7d088c4f1119888ab94ef4b5d6795d1ce05afb7fe159d79f98" dependencies = [ "find-msvc-tools", "jobserver", @@ -871,9 +871,9 @@ dependencies = [ [[package]] name = "crypto-common" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77727bb15fa921304124b128af125e7e3b968275d1b108b379190264f4423710" +checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" dependencies = [ "hybrid-array", ] @@ -928,13 +928,13 @@ dependencies = [ [[package]] name = "digest" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4850db49bf08e663084f7fb5c87d202ef91a3907271aff24a94eb97ff039153c" +checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" dependencies = [ "block-buffer 0.12.0", "const-oid", - "crypto-common 0.2.1", + "crypto-common 0.2.2", ] [[package]] @@ -1030,7 +1030,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -1068,7 +1068,7 @@ checksum = "0ce92ff622d6dadf7349484f42c93271a0d49b7cc4d466a936405bacbe10aa78" dependencies = [ "cfg-if", "rustix 1.1.4", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1112,7 +1112,7 @@ checksum = "94e7099f6313ecacbe1256e8ff9d617b75d1bcb16a6fddef94866d225a01a14a" dependencies = [ "io-lifetimes", "rustix 1.1.4", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1282,9 +1282,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f44da3a8150a6703ed5d34e164b875fd14c2cdab9af1252a9a1020bde2bdc54" +checksum = "171fefbc92fe4a4de27e0698d6a5b392d6a0e333506bc49133760b3bcf948733" dependencies = [ "atomic-waker", "bytes", @@ -1332,9 +1332,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.17.0" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" dependencies = [ "foldhash 0.2.0", ] @@ -1623,9 +1623,9 @@ checksum = "135b12329e5e3ce057a9f972339ea52bc954fe1e9358ef27f95e89716fbc5424" [[package]] name = "hybrid-array" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d46837a0ed51fe95bd3b05de33cd64a1ee88fc797477ca48446872504507c5" +checksum = "9155a582abd142abc056962c29e3ce5ff2ad5469f4246b537ed42c5deba857da" dependencies = [ "typenum", ] @@ -1815,7 +1815,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" dependencies = [ "equivalent", - "hashbrown 0.17.0", + "hashbrown 0.17.1", "serde", "serde_core", ] @@ -1827,7 +1827,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2285ddfe3054097ef4b2fe909ef8c3bcd1ea52a8f0d274416caebeef39f04a65" dependencies = [ "io-lifetimes", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1948,9 +1948,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.97" +version = "0.3.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1840c94c045fbcf8ba2812c95db44499f7c64910a912551aaaa541decebcacf" +checksum = "67df7112613f8bfd9150013a0314e196f4800d3201ae742489d999db2f979f08" dependencies = [ "cfg-if", "futures-util", @@ -2183,9 +2183,9 @@ dependencies = [ [[package]] name = "num-conv" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6673768db2d862beb9b39a78fdcb1a69439615d5794a1be50caa9bc92c81967" +checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" [[package]] name = "num-integer" @@ -2212,7 +2212,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e5a6c098c7a3b6547378093f5cc30bc54fd361ce711e05293a5cc589562739b" dependencies = [ "crc32fast", - "hashbrown 0.17.0", + "hashbrown 0.17.1", "indexmap", "memchr", ] @@ -2290,18 +2290,18 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "pin-project" -version = "1.1.11" +version = "1.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1749c7ed4bcaf4c3d0a3efc28538844fb29bcdd7d2b67b2be7e20ba861ff517" +checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.11" +version = "1.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b20ed30f105399776b9c883e68e536ef602a16ae6f596d2c473591d6ad64c6" +checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b" dependencies = [ "proc-macro2", "quote", @@ -2485,7 +2485,7 @@ dependencies = [ "once_cell", "socket2", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.60.2", ] [[package]] @@ -2671,7 +2671,7 @@ checksum = "de2c52737737f8609e94f975dee22854a2d5c125772d4b1cf292120f4d45c186" dependencies = [ "allocator-api2", "bumpalo", - "hashbrown 0.17.0", + "hashbrown 0.17.1", "log", "rustc-hash", "smallvec", @@ -2794,7 +2794,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.4.15", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2807,7 +2807,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.12.1", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -2875,7 +2875,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -3046,7 +3046,7 @@ checksum = "446ba717509524cb3f22f17ecc096f10f4822d76ab5c0b9822c5f9c284e825f4" dependencies = [ "cfg-if", "cpufeatures 0.3.0", - "digest 0.11.2", + "digest 0.11.3", ] [[package]] @@ -3181,6 +3181,37 @@ dependencies = [ "wrpc-transport-quic", ] +[[package]] +name = "streams-tcp-client" +version = "0.1.0" +dependencies = [ + "anyhow", + "bytes", + "clap", + "futures", + "tokio", + "tokio-stream", + "tracing", + "tracing-subscriber", + "wit-bindgen-wrpc", + "wrpc-transport", +] + +[[package]] +name = "streams-tcp-server" +version = "0.1.0" +dependencies = [ + "anyhow", + "bytes", + "clap", + "futures", + "tokio", + "tracing", + "tracing-subscriber", + "wit-bindgen-wrpc", + "wrpc-transport", +] + [[package]] name = "strsim" version = "0.11.1" @@ -3236,7 +3267,7 @@ dependencies = [ "fd-lock", "io-lifetimes", "rustix 0.38.44", - "windows-sys 0.52.0", + "windows-sys 0.59.0", "winx", ] @@ -3255,7 +3286,7 @@ dependencies = [ "fastrand", "once_cell", "rustix 1.1.4", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -3537,7 +3568,7 @@ version = "1.1.2+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" dependencies = [ - "winnow 1.0.2", + "winnow 1.0.3", ] [[package]] @@ -4002,9 +4033,9 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.120" +version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df52b6d9b87e0c74c9edfa1eb2d9bf85e5d63515474513aa50fa181b3c4f5db1" +checksum = "49ace1d07c165b0864824eee619580c4689389afa9dc9ed3a4c75040d82e6790" dependencies = [ "cfg-if", "once_cell", @@ -4015,9 +4046,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.70" +version = "0.4.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af934872acec734c2d80e6617bbb5ff4f12b052dd8e6332b0817bce889516084" +checksum = "96492d0d3ffba25305a7dc88720d250b1401d7edca02cc3bcd50633b424673b8" dependencies = [ "js-sys", "wasm-bindgen", @@ -4025,9 +4056,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.120" +version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b1041f495fb322e64aca85f5756b2172e35cd459376e67f2a6c9dffcedb103" +checksum = "8e68e6f4afd367a562002c05637acb8578ff2dea1943df76afb9e83d177c8578" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4035,9 +4066,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.120" +version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dcd0ff20416988a18ac686d4d4d0f6aae9ebf08a389ff5d29012b05af2a1b41" +checksum = "d95a9ec35c64b2a7cb35d3fead40c4238d0940c86d107136999567a4703259f2" dependencies = [ "bumpalo", "proc-macro2", @@ -4048,9 +4079,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.120" +version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49757b3c82ebf16c57d69365a142940b384176c24df52a087fb748e2085359ea" +checksum = "c4e0100b01e9f0d03189a92b96772a1fb998639d981193d7dbab487302513441" dependencies = [ "unicode-ident", ] @@ -4085,16 +4116,6 @@ dependencies = [ "wasmparser 0.246.2", ] -[[package]] -name = "wasm-encoder" -version = "0.248.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac92cf547bc18d27ecc521015c08c353b4f18b84ab388bb6d1b6b682c620d9b6" -dependencies = [ - "leb128fmt", - "wasmparser 0.248.0", -] - [[package]] name = "wasm-encoder" version = "0.249.0" @@ -4213,17 +4234,6 @@ dependencies = [ "serde", ] -[[package]] -name = "wasmparser" -version = "0.248.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa4439c5eee9df71ee0c6efb37f63b1fcb1fec38f85f5142c54e7ed05d33091a" -dependencies = [ - "bitflags", - "indexmap", - "semver", -] - [[package]] name = "wasmparser" version = "0.249.0" @@ -4231,7 +4241,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30538cae9a794215f490b532df01c557e2e2bfac92569482554acd0992a102ea" dependencies = [ "bitflags", - "hashbrown 0.17.0", + "hashbrown 0.17.1", "indexmap", "semver", ] @@ -4582,31 +4592,31 @@ dependencies = [ [[package]] name = "wast" -version = "248.0.0" +version = "249.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acc54622ed5a5cddafcdf152043f9d4aed54d4a653d686b7dfe874809fca99d7" +checksum = "2474a321bf9ae2808e9fa23ac4ec2b27300e70985e30bcb5a38d43b76bfc901a" dependencies = [ "bumpalo", "leb128fmt", "memchr", "unicode-width", - "wasm-encoder 0.248.0", + "wasm-encoder 0.249.0", ] [[package]] name = "wat" -version = "1.248.0" +version = "1.249.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75cd9e510603909748e6ebab89f27cd04472c1d9d85a3c88a7a6fc51a1a7934" +checksum = "28af699d0a9c7e4e250b7b8e36167ae5215fbb4b7ae526bb4ce7b234ba0afc90" dependencies = [ "wast", ] [[package]] name = "web-sys" -version = "0.3.97" +version = "0.3.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eadbac71025cd7b0834f20d1fe8472e8495821b4e9801eb0a60bd1f19827602" +checksum = "4b572dff8bcf38bad0fa19729c89bb5748b2b9b1d8be70cf90df697e3a8f32aa" dependencies = [ "js-sys", "wasm-bindgen", @@ -4671,7 +4681,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -4776,6 +4786,24 @@ 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-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + [[package]] name = "windows-sys" version = "0.61.2" @@ -4809,13 +4837,30 @@ dependencies = [ "windows_aarch64_gnullvm 0.52.6", "windows_aarch64_msvc 0.52.6", "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm", + "windows_i686_gnullvm 0.52.6", "windows_i686_msvc 0.52.6", "windows_x86_64_gnu 0.52.6", "windows_x86_64_gnullvm 0.52.6", "windows_x86_64_msvc 0.52.6", ] +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" @@ -4828,6 +4873,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + [[package]] name = "windows_aarch64_msvc" version = "0.42.2" @@ -4840,6 +4891,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + [[package]] name = "windows_i686_gnu" version = "0.42.2" @@ -4852,12 +4909,24 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + [[package]] name = "windows_i686_msvc" version = "0.42.2" @@ -4870,6 +4939,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + [[package]] name = "windows_x86_64_gnu" version = "0.42.2" @@ -4882,6 +4957,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" @@ -4894,6 +4975,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + [[package]] name = "windows_x86_64_msvc" version = "0.42.2" @@ -4906,6 +4993,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + [[package]] name = "winnow" version = "0.7.15" @@ -4914,9 +5007,9 @@ checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" [[package]] name = "winnow" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ee1708bef14716a11bae175f579062d4554d95be2c6829f518df847b7b3fdd0" +checksum = "0592e1c9d151f854e6fd382574c3a0855250e1d9b2f99d9281c6e6391af352f1" [[package]] name = "winx" @@ -4925,7 +5018,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f3fd376f71958b862e7afb20cfe5a22830e1963462f3a17f49d82a6c1d1f42d" dependencies = [ "bitflags", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -5246,7 +5339,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50840f2e2cf170d910858089d7dfb3e97c6f9a0d6ec7bff7f7cc28f5aeacc15f" dependencies = [ "anyhow", - "hashbrown 0.17.0", + "hashbrown 0.17.1", "id-arena", "indexmap", "log", @@ -5619,9 +5712,9 @@ dependencies = [ [[package]] name = "zerofrom" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69faa1f2a1ea75661980b013019ed6687ed0e83d069bc1114e2cc74c6c04c4df" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" dependencies = [ "zerofrom-derive", ] diff --git a/examples/rust/streams-tcp-client/Cargo.toml b/examples/rust/streams-tcp-client/Cargo.toml new file mode 100644 index 00000000..089b4938 --- /dev/null +++ b/examples/rust/streams-tcp-client/Cargo.toml @@ -0,0 +1,33 @@ +[package] +name = "streams-tcp-client" +version = "0.1.0" + +authors.workspace = true +categories.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true + +[dependencies] +anyhow = { workspace = true, features = ["std"] } +bytes = { workspace = true } +clap = { workspace = true, features = [ + "color", + "derive", + "error-context", + "help", + "std", + "suggestions", + "usage", +] } +futures = { workspace = true } +tokio = { workspace = true, features = ["rt-multi-thread"] } +tokio-stream = { workspace = true, features = ["time"] } +tracing = { workspace = true } +tracing-subscriber = { workspace = true, features = [ + "ansi", + "env-filter", + "fmt", +] } +wit-bindgen-wrpc = { workspace = true } +wrpc-transport = { workspace = true, features = ["net"] } diff --git a/examples/rust/streams-tcp-client/src/main.rs b/examples/rust/streams-tcp-client/src/main.rs new file mode 100644 index 00000000..86fc8eb6 --- /dev/null +++ b/examples/rust/streams-tcp-client/src/main.rs @@ -0,0 +1,80 @@ +use core::time::Duration; + +use anyhow::Context as _; +use bytes::Bytes; +use clap::Parser; +use futures::{stream, StreamExt as _}; +use tokio::{time, try_join}; +use tokio_stream::wrappers::IntervalStream; +use tracing::debug; + +mod bindings { + wit_bindgen_wrpc::generate!({ + with: { + "wrpc-examples:streams/handler": generate + } + }); +} + +use bindings::wrpc_examples::streams::handler::{echo, Req}; + +#[derive(Parser, Debug)] +#[command(author, version, about, long_about = None)] +struct Args { + /// Address to invoke `wrpc-examples:streams/handler.echo` on + #[arg(default_value = "[::1]:7762")] + addr: String, +} + +#[tokio::main] +async fn main() -> anyhow::Result<()> { + tracing_subscriber::fmt().init(); + + let Args { addr } = Args::parse(); + + let wrpc = wrpc_transport::tcp::Client::from(&addr); + + let numbers = Box::pin( + stream::iter(1..) + .take(10) + .zip(IntervalStream::new(time::interval(Duration::from_secs(1)))) + .map(|(i, _)| i) + .ready_chunks(10), + ); + + // `stream` items are chunked using [`Bytes`] + let bytes = Box::pin( + stream::iter(b"foo bar baz") + .zip(IntervalStream::new(time::interval(Duration::from_secs(1)))) + .map(|(i, _)| *i) + .ready_chunks(10) + .map(Bytes::from), + ); + + let (mut numbers, mut bytes, io) = echo(&wrpc, (), Req { numbers, bytes }) + .await + .context("failed to invoke `wrpc-examples:streams/handler.echo`")?; + try_join!( + async { + if let Some(io) = io { + debug!("performing async I/O"); + io.await.context("failed to complete async I/O") + } else { + Ok(()) + } + }, + async { + while let Some(item) = numbers.next().await { + eprintln!("numbers: {item:?}"); + } + Ok(()) + }, + async { + while let Some(item) = bytes.next().await { + eprintln!("bytes: {item:?}"); + } + Ok(()) + } + )?; + Ok(()) +} diff --git a/examples/rust/streams-tcp-client/wit/deps.lock b/examples/rust/streams-tcp-client/wit/deps.lock new file mode 100644 index 00000000..64064272 --- /dev/null +++ b/examples/rust/streams-tcp-client/wit/deps.lock @@ -0,0 +1,4 @@ +[streams] +path = "../../../wit/streams" +sha256 = "5064bee90ebea73f1695987191fbbfea71ed2dbb69839814009490b4fbe8e96f" +sha512 = "dfca3844d91c6c8e83fefd7b9511a366b464cf69d017c61b671409cb26dc9490a0e59a8e60ef15b77fdeb4fc1b8d9e6efa11c2fb1a1dabd0141e5e6afe8a59b9" diff --git a/examples/rust/streams-tcp-client/wit/deps.toml b/examples/rust/streams-tcp-client/wit/deps.toml new file mode 100644 index 00000000..7ad7d00c --- /dev/null +++ b/examples/rust/streams-tcp-client/wit/deps.toml @@ -0,0 +1 @@ +streams = "../../../wit/streams" diff --git a/examples/rust/streams-tcp-client/wit/deps/streams/streams.wit b/examples/rust/streams-tcp-client/wit/deps/streams/streams.wit new file mode 100644 index 00000000..8520741c --- /dev/null +++ b/examples/rust/streams-tcp-client/wit/deps/streams/streams.wit @@ -0,0 +1,17 @@ +package wrpc-examples:streams; + +interface handler { + record req { + numbers: stream, + bytes: stream, + } + echo: func(r: req) -> (numbers: stream, bytes: stream); +} + +world client { + import handler; +} + +world server { + export handler; +} diff --git a/examples/rust/streams-tcp-client/wit/world.wit b/examples/rust/streams-tcp-client/wit/world.wit new file mode 100644 index 00000000..5f6997fd --- /dev/null +++ b/examples/rust/streams-tcp-client/wit/world.wit @@ -0,0 +1,5 @@ +package wrpc-examples:streams-rust-client; + +world client { + include wrpc-examples:streams/client; +} diff --git a/examples/rust/streams-tcp-server/Cargo.toml b/examples/rust/streams-tcp-server/Cargo.toml new file mode 100644 index 00000000..684c77ad --- /dev/null +++ b/examples/rust/streams-tcp-server/Cargo.toml @@ -0,0 +1,32 @@ +[package] +name = "streams-tcp-server" +version = "0.1.0" + +authors.workspace = true +categories.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true + +[dependencies] +anyhow = { workspace = true, features = ["std"] } +bytes = { workspace = true } +clap = { workspace = true, features = [ + "color", + "derive", + "error-context", + "help", + "std", + "suggestions", + "usage", +] } +futures = { workspace = true } +tokio = { workspace = true, features = ["net", "rt-multi-thread", "signal"] } +tracing = { workspace = true } +tracing-subscriber = { workspace = true, features = [ + "ansi", + "env-filter", + "fmt", +] } +wit-bindgen-wrpc = { workspace = true } +wrpc-transport = { workspace = true, features = ["net"] } diff --git a/examples/rust/streams-tcp-server/src/main.rs b/examples/rust/streams-tcp-server/src/main.rs new file mode 100644 index 00000000..75114033 --- /dev/null +++ b/examples/rust/streams-tcp-server/src/main.rs @@ -0,0 +1,119 @@ +use core::net::SocketAddr; +use core::pin::{pin, Pin}; + +use std::sync::Arc; + +use anyhow::Context as _; +use bytes::Bytes; +use clap::Parser; +use futures::stream::select_all; +use futures::{Stream, StreamExt as _}; +use tokio::task::JoinSet; +use tokio::{select, signal}; +use tracing::{debug, error, info, warn}; + +mod bindings { + wit_bindgen_wrpc::generate!({ + with: { + "wrpc-examples:streams/handler": generate, + } + }); +} + +use bindings::exports::wrpc_examples::streams::handler::Req; + +#[derive(Parser, Debug)] +#[command(author, version, about, long_about = None)] +struct Args { + /// Address to serve `wrpc-examples:streams/handler.echo` on + #[arg(default_value = "[::1]:7762")] + addr: String, +} + +#[derive(Clone, Copy)] +struct Server; + +impl bindings::exports::wrpc_examples::streams::handler::Handler for Server { + async fn echo( + &self, + _ctx: SocketAddr, + Req { numbers, bytes }: Req, + ) -> anyhow::Result<( + Pin> + Send>>, + Pin + Send>>, + )> { + Ok((numbers, bytes)) + } +} + +#[tokio::main] +async fn main() -> anyhow::Result<()> { + tracing_subscriber::fmt().init(); + + let Args { addr } = Args::parse(); + + let lis = tokio::net::TcpListener::bind(&addr) + .await + .with_context(|| format!("failed to bind TCP listener on `{addr}`"))?; + let srv = Arc::new(wrpc_transport::Server::default()); + let accept = tokio::spawn({ + let srv = Arc::clone(&srv); + async move { + loop { + if let Err(err) = srv.accept(&lis).await { + error!(?err, "failed to accept TCP connection"); + } + } + } + }); + + let invocations = bindings::serve(srv.as_ref(), Server) + .await + .context("failed to serve `wrpc-examples:streams/handler.echo`")?; + // NOTE: This will conflate all invocation streams into a single stream via `futures::stream::SelectAll`, + // to customize this, iterate over the returned `invocations` and set up custom handling per export + let mut invocations = select_all( + invocations + .into_iter() + .map(|(instance, name, invocations)| invocations.map(move |res| (instance, name, res))), + ); + let shutdown = signal::ctrl_c(); + let mut shutdown = pin!(shutdown); + let mut tasks = JoinSet::new(); + loop { + select! { + Some((instance, name, res)) = invocations.next() => { + match res { + Ok(fut) => { + debug!(instance, name, "invocation accepted"); + tasks.spawn(async move { + if let Err(err) = fut.await { + warn!(?err, "failed to handle invocation"); + } else { + info!(instance, name, "invocation successfully handled"); + } + }); + } + Err(err) => { + warn!(?err, instance, name, "failed to accept invocation"); + } + } + } + Some(res) = tasks.join_next() => { + if let Err(err) = res { + error!(?err, "failed to join task") + } + } + res = &mut shutdown => { + accept.abort(); + // wait for all invocations to complete + while let Some(res) = tasks.join_next().await { + if let Err(err) = res { + error!(?err, "failed to join task") + } + } + return res.context("failed to listen for ^C") + } + } + } +} diff --git a/examples/rust/streams-tcp-server/wit/deps.lock b/examples/rust/streams-tcp-server/wit/deps.lock new file mode 100644 index 00000000..64064272 --- /dev/null +++ b/examples/rust/streams-tcp-server/wit/deps.lock @@ -0,0 +1,4 @@ +[streams] +path = "../../../wit/streams" +sha256 = "5064bee90ebea73f1695987191fbbfea71ed2dbb69839814009490b4fbe8e96f" +sha512 = "dfca3844d91c6c8e83fefd7b9511a366b464cf69d017c61b671409cb26dc9490a0e59a8e60ef15b77fdeb4fc1b8d9e6efa11c2fb1a1dabd0141e5e6afe8a59b9" diff --git a/examples/rust/streams-tcp-server/wit/deps.toml b/examples/rust/streams-tcp-server/wit/deps.toml new file mode 100644 index 00000000..7ad7d00c --- /dev/null +++ b/examples/rust/streams-tcp-server/wit/deps.toml @@ -0,0 +1 @@ +streams = "../../../wit/streams" diff --git a/examples/rust/streams-tcp-server/wit/deps/streams/streams.wit b/examples/rust/streams-tcp-server/wit/deps/streams/streams.wit new file mode 100644 index 00000000..8520741c --- /dev/null +++ b/examples/rust/streams-tcp-server/wit/deps/streams/streams.wit @@ -0,0 +1,17 @@ +package wrpc-examples:streams; + +interface handler { + record req { + numbers: stream, + bytes: stream, + } + echo: func(r: req) -> (numbers: stream, bytes: stream); +} + +world client { + import handler; +} + +world server { + export handler; +} diff --git a/examples/rust/streams-tcp-server/wit/world.wit b/examples/rust/streams-tcp-server/wit/world.wit new file mode 100644 index 00000000..ba3ffa1b --- /dev/null +++ b/examples/rust/streams-tcp-server/wit/world.wit @@ -0,0 +1,5 @@ +package wrpc-examples:streams-rust-server; + +world server { + include wrpc-examples:streams/server; +}