From 088cb6a2478c2d464b2a2fdbddb04a62356293bb Mon Sep 17 00:00:00 2001 From: Lawrence Bethlenfalvy Date: Wed, 3 Sep 2025 18:42:54 +0200 Subject: [PATCH] updated all deps migrated away from paste and async-std --- Cargo.lock | 538 +++++++++++++++---------- Cargo.toml | 3 +- orchid-api-derive/Cargo.toml | 8 +- orchid-api-derive/src/decode.rs | 2 +- orchid-api-derive/src/encode.rs | 2 +- orchid-api-traits/Cargo.toml | 3 +- orchid-api-traits/src/coding.rs | 83 ++-- orchid-api-traits/src/helpers.rs | 8 +- orchid-api-traits/src/lib.rs | 2 +- orchid-api/Cargo.toml | 2 +- orchid-api/src/proto.rs | 10 +- orchid-base/Cargo.toml | 15 +- orchid-base/src/error.rs | 2 +- orchid-base/src/interner.rs | 2 +- orchid-base/src/msg.rs | 6 +- orchid-base/src/reqnot.rs | 15 +- orchid-extension/Cargo.toml | 25 +- orchid-extension/src/atom.rs | 30 +- orchid-extension/src/atom_owned.rs | 21 +- orchid-extension/src/atom_thin.rs | 9 +- orchid-extension/src/coroutine_exec.rs | 34 +- orchid-extension/src/entrypoint.rs | 57 +-- orchid-extension/src/func_atom.rs | 7 +- orchid-extension/src/lib.rs | 2 +- orchid-extension/src/msg.rs | 5 +- orchid-extension/src/reflection.rs | 2 +- orchid-extension/src/system_ctor.rs | 4 +- orchid-extension/src/tokio.rs | 19 +- orchid-host/Cargo.toml | 12 +- orchid-host/src/ctx.rs | 2 +- orchid-host/src/execute.rs | 2 +- orchid-host/src/expr.rs | 2 +- orchid-host/src/extension.rs | 23 +- orchid-host/src/lex.rs | 2 +- orchid-host/src/subprocess.rs | 8 +- orchid-host/src/tree.rs | 2 +- orchid-macros/Cargo.toml | 6 - orchid-macros/src/main.rs | 3 - orchid-std/Cargo.toml | 13 +- orchid-std/src/macros/let_line.rs | 7 +- orchid-std/src/macros/macro_line.rs | 7 +- orchid-std/src/macros/macro_system.rs | 12 +- orchid-std/src/std/std_system.rs | 2 +- orchid-std/src/std/string/str_atom.rs | 6 +- 44 files changed, 569 insertions(+), 456 deletions(-) delete mode 100644 orchid-macros/Cargo.toml delete mode 100644 orchid-macros/src/main.rs diff --git a/Cargo.lock b/Cargo.lock index 1a51e5d..8bda1fa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -23,22 +23,22 @@ version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ - "getrandom", + "getrandom 0.2.15", "once_cell", "version_check", ] [[package]] name = "ahash" -version = "0.8.11" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" dependencies = [ "cfg-if", - "getrandom", + "getrandom 0.3.3", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.8.26", ] [[package]] @@ -175,7 +175,7 @@ dependencies = [ "futures-lite", "parking", "polling", - "rustix", + "rustix 0.38.43", "slab", "tracing", "windows-sys 0.59.0", @@ -183,9 +183,9 @@ dependencies = [ [[package]] name = "async-lock" -version = "3.4.0" +version = "3.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" +checksum = "5fd03604047cee9b6ce9de9f70c6cd540a0520c813cbd49bae61f33ab80ed1dc" dependencies = [ "event-listener 5.4.0", "event-listener-strategy", @@ -200,9 +200,9 @@ checksum = "4288f83726785267c6f2ef073a3d83dc3f9b81464e9f99898240cced85fce35a" [[package]] name = "async-process" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63255f1dc2381611000436537bbedfe83183faa303a5a0edaf191edef06526bb" +checksum = "65daa13722ad51e6ab1a1b9c01299142bc75135b337923cfa10e79bbbd669f00" dependencies = [ "async-channel 2.3.1", "async-io", @@ -213,8 +213,7 @@ dependencies = [ "cfg-if", "event-listener 5.4.0", "futures-lite", - "rustix", - "tracing", + "rustix 1.0.8", ] [[package]] @@ -229,7 +228,7 @@ dependencies = [ "cfg-if", "futures-core", "futures-io", - "rustix", + "rustix 0.38.43", "signal-hook-registry", "slab", "windows-sys 0.59.0", @@ -237,9 +236,9 @@ dependencies = [ [[package]] name = "async-std" -version = "1.13.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c634475f29802fde2b8f0b505b1bd00dfe4df7d4a000f0b36f7671197d5c3615" +checksum = "2c8e079a4ab67ae52b7403632e4618815d6db36d2a010cfe41b02c1b1578f93b" dependencies = [ "async-channel 1.9.0", "async-global-executor", @@ -278,9 +277,9 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ - "proc-macro2 1.0.92", - "quote 1.0.38", - "syn 2.0.95", + "proc-macro2 1.0.101", + "quote 1.0.40", + "syn 2.0.106", ] [[package]] @@ -362,7 +361,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88376f98b48312155a0ba2f868ad705f5d5b9a1065514b1f827e31c1d2f3dbb0" dependencies = [ - "logwise", + "logwise 0.3.0", ] [[package]] @@ -383,9 +382,9 @@ checksum = "c2593a3b8b938bd68373196c9832f516be11fa487ef4ae745eb282e6a56a7244" dependencies = [ "once_cell", "proc-macro-crate", - "proc-macro2 1.0.92", - "quote 1.0.38", - "syn 2.0.95", + "proc-macro2 1.0.101", + "quote 1.0.40", + "syn 2.0.106", ] [[package]] @@ -417,8 +416,8 @@ version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3db406d29fbcd95542e92559bed4d8ad92636d1ca8b3b72ede10b4bcc010e659" dependencies = [ - "proc-macro2 1.0.92", - "quote 1.0.38", + "proc-macro2 1.0.101", + "quote 1.0.40", "syn 1.0.109", ] @@ -481,9 +480,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54b755194d6389280185988721fffba69495eed5ee9feeee9a599b53db80318c" dependencies = [ "heck", - "proc-macro2 1.0.92", - "quote 1.0.38", - "syn 2.0.95", + "proc-macro2 1.0.101", + "quote 1.0.40", + "syn 2.0.106", ] [[package]] @@ -509,9 +508,24 @@ dependencies = [ [[package]] name = "const_panic" -version = "0.2.11" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53857514f72ee4a2b583de67401e3ff63a5472ca4acf289d09a9ea7636dfec17" +checksum = "bb8a602185c3c95b52f86dc78e55a6df9a287a7a93ddbcf012509930880cf879" +dependencies = [ + "typewit", +] + +[[package]] +name = "continue" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46f3dc39cda960e9f5594a713c0a4687f85c25f591c67862f107cb009cdd6c46" +dependencies = [ + "atomic-waker", + "logwise 0.2.3", + "thiserror", + "wasm-bindgen", +] [[package]] name = "cpufeatures" @@ -550,9 +564,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.10" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" dependencies = [ "darling_core", "darling_macro", @@ -560,27 +574,27 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.10" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4" dependencies = [ "fnv", "ident_case", - "proc-macro2 1.0.92", - "quote 1.0.38", + "proc-macro2 1.0.101", + "quote 1.0.40", "strsim", - "syn 2.0.95", + "syn 2.0.106", ] [[package]] name = "darling_macro" -version = "0.20.10" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ "darling_core", - "quote 1.0.38", - "syn 2.0.95", + "quote 1.0.40", + "syn 2.0.106", ] [[package]] @@ -606,9 +620,9 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.17" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" [[package]] name = "either" @@ -673,9 +687,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "foldhash" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" [[package]] name = "funty" @@ -750,9 +764,9 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ - "proc-macro2 1.0.92", - "quote 1.0.38", - "syn 2.0.95", + "proc-macro2 1.0.101", + "quote 1.0.40", + "syn 2.0.106", ] [[package]] @@ -803,7 +817,19 @@ checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasi 0.14.3+wasi-0.2.4", ] [[package]] @@ -838,6 +864,12 @@ name = "hashbrown" version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" + +[[package]] +name = "hashbrown" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" dependencies = [ "allocator-api2", "equivalent", @@ -877,8 +909,8 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7cab85a7ed0bd5f0e76d93846e0147172bed2e2d3f859bcc33a8d9699cad1a75" dependencies = [ - "proc-macro2 1.0.92", - "quote 1.0.38", + "proc-macro2 1.0.101", + "quote 1.0.40", ] [[package]] @@ -925,9 +957,9 @@ checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "js-sys" -version = "0.3.76" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ "once_cell", "wasm-bindgen", @@ -935,30 +967,20 @@ dependencies = [ [[package]] name = "konst" -version = "0.3.16" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4381b9b00c55f251f2ebe9473aef7c117e96828def1a7cb3bd3f0f903c6894e9" +checksum = "e1b7495a4af30134f36ab2018716ba98b092019a6c5dc2126b94e3241c170748" dependencies = [ "const_panic", - "konst_kernel", "konst_proc_macros", "typewit", ] -[[package]] -name = "konst_kernel" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4b1eb7788f3824c629b1116a7a9060d6e898c358ebff59070093d51103dcc3c" -dependencies = [ - "typewit", -] - [[package]] name = "konst_proc_macros" -version = "0.3.10" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00af7901ba50898c9e545c24d5c580c96a982298134e8037d8978b6594782c07" +checksum = "1bf92d396aa2df203577ebef8deaf1efc24d446366ca86be83ec8ac794b157d6" [[package]] name = "kv-log-macro" @@ -977,9 +999,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.169" +version = "0.2.175" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" +checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" [[package]] name = "linux-raw-sys" @@ -987,6 +1009,12 @@ version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" +[[package]] +name = "linux-raw-sys" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" + [[package]] name = "lock_api" version = "0.4.12" @@ -1012,18 +1040,37 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3f379dc0daef8061f0beab09c7d3528c1e238754e937bb640daec3553e1bceb" dependencies = [ - "logwise_proc", + "logwise_proc 0.1.1", "wasm-bindgen", "web-sys", "web-time", ] +[[package]] +name = "logwise" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d09231cef85ff27c65aeadf05f249fb80d6b38c904ac9eb861c1932d4b6c3308" +dependencies = [ + "logwise_proc 0.3.0", + "wasm-bindgen", + "wasm_thread", + "web-sys", + "web-time", +] + [[package]] name = "logwise_proc" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ba61263a12347d87ece9286fab931b7f3407b06a94ab952e676b350d7054a57" +[[package]] +name = "logwise_proc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7494645c8b485fcc0acaa8f382ef8cc081110838536a380e3b3048427f628306" + [[package]] name = "memchr" version = "2.7.4" @@ -1052,7 +1099,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys 0.52.0", ] @@ -1094,15 +1141,15 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.20.2" +version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "orchid-api" version = "0.1.0" dependencies = [ - "async-std", + "futures", "orchid-api-derive", "orchid-api-traits", "ordered-float", @@ -1116,16 +1163,15 @@ dependencies = [ "darling", "itertools", "orchid-api-traits", - "proc-macro2 1.0.92", - "quote 1.0.38", - "syn 2.0.95", + "proc-macro2 1.0.101", + "quote 1.0.40", + "syn 2.0.106", ] [[package]] name = "orchid-api-traits" version = "0.1.0" dependencies = [ - "async-std", "async-stream", "futures", "itertools", @@ -1138,12 +1184,11 @@ name = "orchid-base" version = "0.1.0" dependencies = [ "async-once-cell", - "async-std", "async-stream", "derive_destructure", "dyn-clone", "futures", - "hashbrown 0.15.2", + "hashbrown 0.16.0", "itertools", "lazy_static", "never", @@ -1154,7 +1199,7 @@ dependencies = [ "ordered-float", "regex", "rust-embed", - "some_executor 0.4.0", + "some_executor", "substack", "test_executors", "trait-set", @@ -1164,14 +1209,14 @@ dependencies = [ name = "orchid-extension" version = "0.1.0" dependencies = [ - "ahash 0.8.11", + "ahash 0.8.12", + "async-lock", "async-once-cell", - "async-std", "async-stream", "derive_destructure", "dyn-clone", "futures", - "hashbrown 0.15.2", + "hashbrown 0.16.0", "include_dir", "itertools", "konst", @@ -1185,9 +1230,10 @@ dependencies = [ "orchid-base", "ordered-float", "pastey", - "some_executor 0.5.1", + "some_executor", "substack", "tokio", + "tokio-util", "trait-set", ] @@ -1195,14 +1241,14 @@ dependencies = [ name = "orchid-host" version = "0.1.0" dependencies = [ + "async-lock", "async-once-cell", "async-process", - "async-std", "async-stream", "bound", "derive_destructure", "futures", - "hashbrown 0.15.2", + "hashbrown 0.16.0", "itertools", "lazy_static", "memo-map", @@ -1212,25 +1258,20 @@ dependencies = [ "orchid-api-traits", "orchid-base", "ordered-float", - "paste", + "pastey", "substack", "test_executors", "trait-set", ] -[[package]] -name = "orchid-macros" -version = "0.1.0" - [[package]] name = "orchid-std" version = "0.1.0" dependencies = [ "async-once-cell", - "async-std", "async-stream", "futures", - "hashbrown 0.15.2", + "hashbrown 0.16.0", "itertools", "never", "once_cell", @@ -1301,17 +1342,11 @@ dependencies = [ "windows-targets", ] -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - [[package]] name = "pastey" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3a8cb46bdc156b1c90460339ae6bfd45ba0394e5effbaa640badb4987fdc261" +checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec" [[package]] name = "pin-project-lite" @@ -1346,7 +1381,7 @@ dependencies = [ "concurrent-queue", "hermit-abi", "pin-project-lite", - "rustix", + "rustix 0.38.43", "tracing", "windows-sys 0.59.0", ] @@ -1357,7 +1392,7 @@ version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" dependencies = [ - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -1386,9 +1421,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.92" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" dependencies = [ "unicode-ident", ] @@ -1408,8 +1443,8 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" dependencies = [ - "proc-macro2 1.0.92", - "quote 1.0.38", + "proc-macro2 1.0.101", + "quote 1.0.40", "syn 1.0.109", ] @@ -1424,13 +1459,19 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ - "proc-macro2 1.0.92", + "proc-macro2 1.0.101", ] +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + [[package]] name = "radium" version = "0.7.0" @@ -1464,7 +1505,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom", + "getrandom 0.2.15", ] [[package]] @@ -1478,9 +1519,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.1" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "23d7fd106d8c02486a8d64e778353d1cffe08ce79ac2e82f540c86d0facf6912" dependencies = [ "aho-corasick", "memchr", @@ -1538,16 +1579,16 @@ version = "0.7.45" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "503d1d27590a2b0a3a4ca4c94755aa2875657196ecbf401a42eff41d7de532c0" dependencies = [ - "proc-macro2 1.0.92", - "quote 1.0.38", + "proc-macro2 1.0.101", + "quote 1.0.40", "syn 1.0.109", ] [[package]] name = "rust-embed" -version = "8.5.0" +version = "8.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa66af4a4fdd5e7ebc276f115e895611a34739a9c1c01028383d612d550953c0" +checksum = "025908b8682a26ba8d12f6f2d66b987584a4a87bc024abc5bbc12553a8cd178a" dependencies = [ "rust-embed-impl", "rust-embed-utils", @@ -1556,22 +1597,22 @@ dependencies = [ [[package]] name = "rust-embed-impl" -version = "8.5.0" +version = "8.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6125dbc8867951125eec87294137f4e9c2c96566e61bf72c45095a7c77761478" +checksum = "6065f1a4392b71819ec1ea1df1120673418bf386f50de1d6f54204d836d4349c" dependencies = [ - "proc-macro2 1.0.92", - "quote 1.0.38", + "proc-macro2 1.0.101", + "quote 1.0.40", "rust-embed-utils", - "syn 2.0.95", + "syn 2.0.106", "walkdir", ] [[package]] name = "rust-embed-utils" -version = "8.5.0" +version = "8.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e5347777e9aacb56039b0e1f28785929a8a3b709e87482e7442c72e7c12529d" +checksum = "f6cc0c81648b20b70c491ff8cce00c1c3b223bb8ed2b5d41f0e54c6c4c0a3594" dependencies = [ "sha2", "walkdir", @@ -1579,9 +1620,9 @@ dependencies = [ [[package]] name = "rust_decimal" -version = "1.36.0" +version = "1.37.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b082d80e3e3cc52b2ed634388d436fe1f4de6af5786cc2de9ba9737527bdf555" +checksum = "b203a6425500a03e0919c42d3c47caca51e79f1132046626d2c8871c5092035d" dependencies = [ "arrayvec", "borsh", @@ -1608,10 +1649,29 @@ dependencies = [ "bitflags", "errno", "libc", - "linux-raw-sys", + "linux-raw-sys 0.4.15", "windows-sys 0.59.0", ] +[[package]] +name = "rustix" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys 0.9.4", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + [[package]] name = "ryu" version = "1.0.18" @@ -1654,9 +1714,9 @@ version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" dependencies = [ - "proc-macro2 1.0.92", - "quote 1.0.38", - "syn 2.0.95", + "proc-macro2 1.0.101", + "quote 1.0.40", + "syn 2.0.106", ] [[package]] @@ -1714,48 +1774,26 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" -version = "0.5.8" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" +checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "some_executor" -version = "0.3.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dde6a7a1595533e5bd451727a6f9c679e54160fc67a9efbaed30a9e8f7e79a01" -dependencies = [ - "priority", - "wasm-bindgen", - "web-time", -] - -[[package]] -name = "some_executor" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8df557f5c4423b8c7b5efa248bd911d3908c095f6a64a002df51230534fd7bdf" -dependencies = [ - "atomic-waker", - "priority", - "wasm-bindgen", - "wasm_thread", - "web-sys", - "web-time", -] - -[[package]] -name = "some_executor" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb323f85458f395c28b5ea35a2626e9f46a35f1d730d37e6fa24dcf2848835ee" +checksum = "4eb94ffe205bde5bf9db6972e4ba7e316ec79568df830627a2388abb5d2c2907" dependencies = [ "atomic-waker", + "continue", + "js-sys", "priority", "wasm-bindgen", + "wasm-bindgen-futures", "wasm_thread", "web-sys", "web-time", @@ -1794,19 +1832,19 @@ version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ - "proc-macro2 1.0.92", - "quote 1.0.38", + "proc-macro2 1.0.101", + "quote 1.0.40", "unicode-ident", ] [[package]] name = "syn" -version = "2.0.95" +version = "2.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46f71c0377baf4ef1cc3e3402ded576dccc315800fbc62dfc7fe04b009773b4a" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" dependencies = [ - "proc-macro2 1.0.92", - "quote 1.0.38", + "proc-macro2 1.0.101", + "quote 1.0.40", "unicode-ident", ] @@ -1818,16 +1856,16 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "test_executors" -version = "0.3.2" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23ce2c67509cbc71cf72942e95a6ef76309f418fccd966b7540c96a6f6db3435" +checksum = "b7b357ed2d52813470402c94b6a27db6cab2d06c42f28eba9eb4fa6c2491e43d" dependencies = [ "blocking_semaphore", - "logwise", - "priority", - "some_executor 0.3.0", + "logwise 0.3.0", + "some_executor", "test_executors_proc", "wasm-bindgen", + "wasm-bindgen-futures", "web-time", ] @@ -1837,8 +1875,28 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b59087b1e1332227b88c6e0ac2ca8fefccb3e2ae2caa48690a5f9cca851a2e7e" dependencies = [ - "quote 1.0.38", - "syn 2.0.95", + "quote 1.0.40", + "syn 2.0.106", +] + +[[package]] +name = "thiserror" +version = "2.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3467d614147380f2e4e374161426ff399c91084acd2363eaf549172b3d5e60c0" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c5e1be1c48b9172ee610da68fd9cd2770e7a4056cb3fc98710ee6906f0c7960" +dependencies = [ + "proc-macro2 1.0.101", + "quote 1.0.40", + "syn 2.0.106", ] [[package]] @@ -1858,9 +1916,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.46.1" +version = "1.47.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cc3a2344dafbe23a245241fe8b09735b521110d30fcefbbd5feb1797ca35d17" +checksum = "89e49afdadebb872d3145a5638b59eb0691ea23e46ca484037cfab3b76b95038" dependencies = [ "backtrace", "bytes", @@ -1873,7 +1931,7 @@ dependencies = [ "slab", "socket2", "tokio-macros", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1882,9 +1940,23 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ - "proc-macro2 1.0.92", - "quote 1.0.38", - "syn 2.0.95", + "proc-macro2 1.0.101", + "quote 1.0.40", + "syn 2.0.106", +] + +[[package]] +name = "tokio-util" +version = "0.7.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14307c986784f72ef81c89db7d9e28d6ac26d16213b109ea501696195e6e3ce5" +dependencies = [ + "bytes", + "futures-core", + "futures-io", + "futures-sink", + "pin-project-lite", + "tokio", ] [[package]] @@ -1926,8 +1998,8 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b79e2e9c9ab44c6d7c20d5976961b47e8f49ac199154daa514b77cd1ab536625" dependencies = [ - "proc-macro2 1.0.92", - "quote 1.0.38", + "proc-macro2 1.0.101", + "quote 1.0.40", "syn 1.0.109", ] @@ -1939,18 +2011,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "typewit" -version = "1.11.0" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb77c29baba9e4d3a6182d51fa75e3215c7fd1dab8f4ea9d107c716878e55fc0" -dependencies = [ - "typewit_proc_macros", -] - -[[package]] -name = "typewit_proc_macros" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36a83ea2b3c704935a01b4642946aadd445cea40b10935e3f8bd8052b8193d6" +checksum = "8e75c3b0d61c1d0e12b4b0fd5111f377c918e0227e9eb67434dcf9e6084646c6" [[package]] name = "unicode-ident" @@ -2005,35 +2068,45 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] -name = "wasm-bindgen" -version = "0.2.99" +name = "wasi" +version = "0.14.3+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" +checksum = "6a51ae83037bdd272a9e28ce236db8c07016dd0d50c27038b3f407533c030c95" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", "once_cell", + "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", - "proc-macro2 1.0.92", - "quote 1.0.38", - "syn 2.0.95", + "proc-macro2 1.0.101", + "quote 1.0.40", + "syn 2.0.106", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.49" +version = "0.4.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38176d9b44ea84e9184eff0bc34cc167ed044f816accfe5922e54d84cf48eca2" +checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" dependencies = [ "cfg-if", "js-sys", @@ -2044,32 +2117,35 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ - "quote 1.0.38", + "quote 1.0.40", "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ - "proc-macro2 1.0.92", - "quote 1.0.38", - "syn 2.0.95", + "proc-macro2 1.0.101", + "quote 1.0.40", + "syn 2.0.106", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] [[package]] name = "wasm_thread" @@ -2085,9 +2161,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.76" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc" +checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" dependencies = [ "js-sys", "wasm-bindgen", @@ -2203,6 +2279,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "wit-bindgen" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "052283831dbae3d879dc7f51f3d92703a316ca49f91540417d38591826127814" + [[package]] name = "wyz" version = "0.5.1" @@ -2226,7 +2308,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ "byteorder", - "zerocopy-derive", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" +dependencies = [ + "zerocopy-derive 0.8.26", ] [[package]] @@ -2235,7 +2326,18 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ - "proc-macro2 1.0.92", - "quote 1.0.38", - "syn 2.0.95", + "proc-macro2 1.0.101", + "quote 1.0.40", + "syn 2.0.106", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" +dependencies = [ + "proc-macro2 1.0.101", + "quote 1.0.40", + "syn 2.0.106", ] diff --git a/Cargo.toml b/Cargo.toml index 550e27d..8d35da0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,5 +10,6 @@ members = [ "orchid-api", "orchid-api-derive", "orchid-api-traits", - "stdio-perftest", "xtask", "orchid-macros", + "stdio-perftest", + "xtask", ] diff --git a/orchid-api-derive/Cargo.toml b/orchid-api-derive/Cargo.toml index 3442e52..133fa5f 100644 --- a/orchid-api-derive/Cargo.toml +++ b/orchid-api-derive/Cargo.toml @@ -9,9 +9,9 @@ proc-macro = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -quote = "1.0.38" -syn = { version = "2.0.95" } +quote = "1.0.40" +syn = { version = "2.0.106" } orchid-api-traits = { version = "0.1.0", path = "../orchid-api-traits" } -proc-macro2 = "1.0.92" -darling = "0.20.10" +proc-macro2 = "1.0.101" +darling = "0.21.3" itertools = "0.14.0" diff --git a/orchid-api-derive/src/decode.rs b/orchid-api-derive/src/decode.rs index 9e16e14..63eb153 100644 --- a/orchid-api-derive/src/decode.rs +++ b/orchid-api-derive/src/decode.rs @@ -12,7 +12,7 @@ pub fn derive(input: TokenStream) -> TokenStream { let decode = decode_body(&input.data); let expanded = quote! { impl #impl_generics orchid_api_traits::Decode for #name #ty_generics #where_clause { - async fn decode( + async fn decode( mut read: std::pin::Pin<&mut R> ) -> Self { #decode diff --git a/orchid-api-derive/src/encode.rs b/orchid-api-derive/src/encode.rs index 7236b42..e39c3f0 100644 --- a/orchid-api-derive/src/encode.rs +++ b/orchid-api-derive/src/encode.rs @@ -14,7 +14,7 @@ pub fn derive(input: TokenStream) -> TokenStream { let encode = encode_body(&input.data); let expanded = quote! { impl #e_impl_generics orchid_api_traits::Encode for #name #e_ty_generics #e_where_clause { - async fn encode( + async fn encode( &self, mut write: std::pin::Pin<&mut W> ) { diff --git a/orchid-api-traits/Cargo.toml b/orchid-api-traits/Cargo.toml index 43ddd63..2763ffd 100644 --- a/orchid-api-traits/Cargo.toml +++ b/orchid-api-traits/Cargo.toml @@ -6,9 +6,8 @@ edition = "2024" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -async-std = "1.13.0" async-stream = "0.3.6" -futures = "0.3.31" +futures = { version = "0.3.31", features = ["std"] } itertools = "0.14.0" never = "0.1.0" ordered-float = "5.0.0" diff --git a/orchid-api-traits/src/coding.rs b/orchid-api-traits/src/coding.rs index f6fff0d..b8757a7 100644 --- a/orchid-api-traits/src/coding.rs +++ b/orchid-api-traits/src/coding.rs @@ -7,9 +7,8 @@ use std::pin::Pin; use std::rc::Rc; use std::sync::Arc; -use async_std::io::{Read, ReadExt, Write, WriteExt}; use async_stream::stream; -use futures::StreamExt; +use futures::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt, StreamExt}; use never::Never; use ordered_float::NotNan; @@ -18,16 +17,16 @@ use crate::encode_enum; pub trait Decode: 'static { /// Decode an instance from the beginning of the buffer. Return the decoded /// data and the remaining buffer. - fn decode(read: Pin<&mut R>) -> impl Future + '_; + fn decode(read: Pin<&mut R>) -> impl Future + '_; } pub trait Encode { /// Append an instance of the struct to the buffer - fn encode(&self, write: Pin<&mut W>) -> impl Future; + fn encode(&self, write: Pin<&mut W>) -> impl Future; } pub trait Coding: Encode + Decode + Clone { fn get_decoder + 'static>( map: impl Fn(Self) -> F + Clone + 'static, - ) -> impl AsyncFn(Pin<&mut dyn Read>) -> T { + ) -> impl AsyncFn(Pin<&mut dyn AsyncRead>) -> T { async move |r| map(Self::decode(r).await).await } } @@ -36,14 +35,14 @@ impl Coding for T {} macro_rules! num_impl { ($number:ty) => { impl Decode for $number { - async fn decode(mut read: Pin<&mut R>) -> Self { + async fn decode(mut read: Pin<&mut R>) -> Self { let mut bytes = [0u8; (<$number>::BITS / 8) as usize]; read.read_exact(&mut bytes).await.unwrap(); <$number>::from_be_bytes(bytes) } } impl Encode for $number { - async fn encode(&self, mut write: Pin<&mut W>) { + async fn encode(&self, mut write: Pin<&mut W>) { write.write_all(&self.to_be_bytes()).await.expect("Could not write number") } } @@ -63,12 +62,12 @@ num_impl!(i8); macro_rules! nonzero_impl { ($name:ty) => { impl Decode for NonZero<$name> { - async fn decode(read: Pin<&mut R>) -> Self { + async fn decode(read: Pin<&mut R>) -> Self { Self::new(<$name as Decode>::decode(read).await).unwrap() } } impl Encode for NonZero<$name> { - async fn encode(&self, write: Pin<&mut W>) { + async fn encode(&self, write: Pin<&mut W>) { self.get().encode(write).await } } @@ -87,19 +86,21 @@ nonzero_impl!(i64); nonzero_impl!(i128); impl Encode for &T { - async fn encode(&self, write: Pin<&mut W>) { (**self).encode(write).await } + async fn encode(&self, write: Pin<&mut W>) { + (**self).encode(write).await + } } macro_rules! float_impl { ($t:ty, $size:expr) => { impl Decode for NotNan<$t> { - async fn decode(mut read: Pin<&mut R>) -> Self { + async fn decode(mut read: Pin<&mut R>) -> Self { let mut bytes = [0u8; $size]; read.read_exact(&mut bytes).await.unwrap(); NotNan::new(<$t>::from_be_bytes(bytes)).expect("Float was NaN") } } impl Encode for NotNan<$t> { - async fn encode(&self, mut write: Pin<&mut W>) { + async fn encode(&self, mut write: Pin<&mut W>) { write.write_all(&self.as_ref().to_be_bytes()).await.expect("Could not write number") } } @@ -110,7 +111,7 @@ float_impl!(f64, 8); float_impl!(f32, 4); impl Decode for String { - async fn decode(mut read: Pin<&mut R>) -> Self { + async fn decode(mut read: Pin<&mut R>) -> Self { let len = u64::decode(read.as_mut()).await.try_into().unwrap(); let mut data = vec![0u8; len]; read.read_exact(&mut data).await.unwrap(); @@ -118,30 +119,30 @@ impl Decode for String { } } impl Encode for String { - async fn encode(&self, mut write: Pin<&mut W>) { + async fn encode(&self, mut write: Pin<&mut W>) { u64::try_from(self.len()).unwrap().encode(write.as_mut()).await; write.write_all(self.as_bytes()).await.unwrap() } } impl Encode for str { - async fn encode(&self, mut write: Pin<&mut W>) { + async fn encode(&self, mut write: Pin<&mut W>) { u64::try_from(self.len()).unwrap().encode(write.as_mut()).await; write.write_all(self.as_bytes()).await.unwrap() } } impl Decode for Vec { - async fn decode(mut read: Pin<&mut R>) -> Self { + async fn decode(mut read: Pin<&mut R>) -> Self { let len = u64::decode(read.as_mut()).await.try_into().unwrap(); stream! { loop { yield T::decode(read.as_mut()).await } }.take(len).collect().await } } impl Encode for Vec { - async fn encode(&self, write: Pin<&mut W>) { + async fn encode(&self, write: Pin<&mut W>) { self.as_slice().encode(write).await } } impl Encode for [T] { - async fn encode(&self, mut write: Pin<&mut W>) { + async fn encode(&self, mut write: Pin<&mut W>) { u64::try_from(self.len()).unwrap().encode(write.as_mut()).await; for t in self.iter() { t.encode(write.as_mut()).await @@ -149,7 +150,7 @@ impl Encode for [T] { } } impl Decode for Option { - async fn decode(mut read: Pin<&mut R>) -> Self { + async fn decode(mut read: Pin<&mut R>) -> Self { match u8::decode(read.as_mut()).await { 0 => None, 1 => Some(T::decode(read).await), @@ -158,14 +159,14 @@ impl Decode for Option { } } impl Encode for Option { - async fn encode(&self, mut write: Pin<&mut W>) { + async fn encode(&self, mut write: Pin<&mut W>) { let t = if let Some(t) = self { t } else { return 0u8.encode(write.as_mut()).await }; 1u8.encode(write.as_mut()).await; t.encode(write).await; } } impl Decode for Result { - async fn decode(mut read: Pin<&mut R>) -> Self { + async fn decode(mut read: Pin<&mut R>) -> Self { match u8::decode(read.as_mut()).await { 0 => Self::Ok(T::decode(read).await), 1 => Self::Err(E::decode(read).await), @@ -175,7 +176,7 @@ impl Decode for Result { } impl Encode for Result { - async fn encode(&self, write: Pin<&mut W>) { + async fn encode(&self, write: Pin<&mut W>) { match self { Ok(t) => encode_enum(write, 0, |w| t.encode(w)).await, Err(e) => encode_enum(write, 1, |w| e.encode(w)).await, @@ -183,13 +184,13 @@ impl Encode for Result { } } impl Decode for HashMap { - async fn decode(mut read: Pin<&mut R>) -> Self { + async fn decode(mut read: Pin<&mut R>) -> Self { let len = u64::decode(read.as_mut()).await.try_into().unwrap(); stream! { loop { yield <(K, V)>::decode(read.as_mut()).await } }.take(len).collect().await } } impl Encode for HashMap { - async fn encode(&self, mut write: Pin<&mut W>) { + async fn encode(&self, mut write: Pin<&mut W>) { u64::try_from(self.len()).unwrap().encode(write.as_mut()).await; for pair in self.iter() { pair.encode(write.as_mut()).await @@ -199,12 +200,12 @@ impl Encode for HashMap { macro_rules! tuple { (($($t:ident)*) ($($T:ident)*)) => { impl<$($T: Decode),*> Decode for ($($T,)*) { - async fn decode(mut read: Pin<&mut R>) -> Self { + async fn decode(mut read: Pin<&mut R>) -> Self { ($($T::decode(read.as_mut()).await,)*) } } impl<$($T: Encode),*> Encode for ($($T,)*) { - async fn encode(&self, mut write: Pin<&mut W>) { + async fn encode(&self, mut write: Pin<&mut W>) { let ($($t,)*) = self; $( $t.encode(write.as_mut()).await; )* } @@ -230,33 +231,33 @@ tuple!((t u v x y z a b c d e f g h i) (T U V X Y Z A B C D E F G H I)); tuple!((t u v x y z a b c d e f g h i j) (T U V X Y Z A B C D E F G H I J)); // 16 impl Decode for () { - async fn decode(_: Pin<&mut R>) -> Self {} + async fn decode(_: Pin<&mut R>) -> Self {} } impl Encode for () { - async fn encode(&self, _: Pin<&mut W>) {} + async fn encode(&self, _: Pin<&mut W>) {} } impl Decode for Never { - async fn decode(_: Pin<&mut R>) -> Self { + async fn decode(_: Pin<&mut R>) -> Self { unreachable!("A value of Never cannot exist so it can't have been serialized"); } } impl Encode for Never { - async fn encode(&self, _: Pin<&mut W>) { match *self {} } + async fn encode(&self, _: Pin<&mut W>) { match *self {} } } impl Decode for bool { - async fn decode(mut read: Pin<&mut R>) -> Self { + async fn decode(mut read: Pin<&mut R>) -> Self { let mut buf = [0]; read.read_exact(&mut buf).await.unwrap(); buf[0] != 0 } } impl Encode for bool { - async fn encode(&self, mut write: Pin<&mut W>) { + async fn encode(&self, mut write: Pin<&mut W>) { write.write_all(&[if *self { 0xffu8 } else { 0u8 }]).await.unwrap() } } impl Decode for [T; N] { - async fn decode(mut read: Pin<&mut R>) -> Self { + async fn decode(mut read: Pin<&mut R>) -> Self { // TODO: figure out how to do this in safe rust on the stack let v = stream! { loop { yield T::decode(read.as_mut()).await } }.take(N).collect::>().await; @@ -264,7 +265,7 @@ impl Decode for [T; N] { } } impl Encode for [T; N] { - async fn encode(&self, mut write: Pin<&mut W>) { + async fn encode(&self, mut write: Pin<&mut W>) { for t in self.iter() { t.encode(write.as_mut()).await } @@ -274,12 +275,12 @@ impl Encode for [T; N] { macro_rules! two_end_range { ($this:ident, $name:tt, $op:tt, $start:expr, $end:expr) => { impl Decode for $name { - async fn decode(mut read: Pin<&mut R>) -> Self { + async fn decode(mut read: Pin<&mut R>) -> Self { T::decode(read.as_mut()).await $op T::decode(read).await } } impl Encode for $name { - async fn encode(&self, mut write: Pin<&mut W>) { + async fn encode(&self, mut write: Pin<&mut W>) { let $this = self; ($start).encode(write.as_mut()).await; ($end).encode(write).await; @@ -294,12 +295,14 @@ two_end_range!(x, RangeInclusive, ..=, x.start(), x.end()); macro_rules! smart_ptr { ($name:tt) => { impl Decode for $name { - async fn decode(read: Pin<&mut R>) -> Self { + async fn decode(read: Pin<&mut R>) -> Self { $name::new(T::decode(read).await) } } impl Encode for $name { - async fn encode(&self, write: Pin<&mut W>) { (**self).encode(write).await } + async fn encode(&self, write: Pin<&mut W>) { + (**self).encode(write).await + } } }; } @@ -309,12 +312,12 @@ smart_ptr!(Rc); smart_ptr!(Box); impl Decode for char { - async fn decode(read: Pin<&mut R>) -> Self { + async fn decode(read: Pin<&mut R>) -> Self { char::from_u32(u32::decode(read).await).unwrap() } } impl Encode for char { - async fn encode(&self, write: Pin<&mut W>) { + async fn encode(&self, write: Pin<&mut W>) { (*self as u32).encode(write).await } } diff --git a/orchid-api-traits/src/helpers.rs b/orchid-api-traits/src/helpers.rs index 5adc319..bf48df0 100644 --- a/orchid-api-traits/src/helpers.rs +++ b/orchid-api-traits/src/helpers.rs @@ -1,12 +1,12 @@ use std::future::Future; use std::pin::Pin; -use async_std::io::{Read, ReadExt, Write, WriteExt}; +use futures::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt}; use itertools::{Chunk, Itertools}; use crate::Encode; -pub async fn encode_enum<'a, W: Write + ?Sized, F: Future>( +pub async fn encode_enum<'a, W: AsyncWrite + ?Sized, F: Future>( mut write: Pin<&'a mut W>, id: u8, f: impl FnOnce(Pin<&'a mut W>) -> F, @@ -15,7 +15,7 @@ pub async fn encode_enum<'a, W: Write + ?Sized, F: Future>( f(write).await } -pub async fn write_exact(mut write: Pin<&mut W>, bytes: &'static [u8]) { +pub async fn write_exact(mut write: Pin<&mut W>, bytes: &'static [u8]) { write.write_all(bytes).await.expect("Failed to write exact bytes") } @@ -27,7 +27,7 @@ pub fn print_bytes(b: &[u8]) -> String { .join(" ") } -pub async fn read_exact(mut read: Pin<&mut R>, bytes: &'static [u8]) { +pub async fn read_exact(mut read: Pin<&mut R>, bytes: &'static [u8]) { let mut data = vec![0u8; bytes.len()]; read.read_exact(&mut data).await.expect("Failed to read bytes"); if data != bytes { diff --git a/orchid-api-traits/src/lib.rs b/orchid-api-traits/src/lib.rs index cbbcfa2..8b10d1e 100644 --- a/orchid-api-traits/src/lib.rs +++ b/orchid-api-traits/src/lib.rs @@ -3,8 +3,8 @@ mod helpers; mod hierarchy; mod relations; -pub use async_std; pub use coding::*; +pub use futures::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt}; pub use helpers::*; pub use hierarchy::*; pub use relations::*; diff --git a/orchid-api/Cargo.toml b/orchid-api/Cargo.toml index 7802f05..5f53b41 100644 --- a/orchid-api/Cargo.toml +++ b/orchid-api/Cargo.toml @@ -9,7 +9,7 @@ edition = "2024" ordered-float = "5.0.0" orchid-api-traits = { version = "0.1.0", path = "../orchid-api-traits" } orchid-api-derive = { version = "0.1.0", path = "../orchid-api-derive" } -async-std = "1.13.0" +futures = { version = "0.3.31", features = ["std"] } [dev-dependencies] test_executors = "0.3.2" diff --git a/orchid-api/src/proto.rs b/orchid-api/src/proto.rs index c58fe14..56f3d8b 100644 --- a/orchid-api/src/proto.rs +++ b/orchid-api/src/proto.rs @@ -24,7 +24,7 @@ use std::pin::Pin; -use async_std::io::{Read, Write}; +use futures::{AsyncRead, AsyncWrite}; use orchid_api_derive::{Coding, Hierarchy}; use orchid_api_traits::{Channel, Decode, Encode, MsgSet, Request, read_exact, write_exact}; @@ -36,7 +36,7 @@ pub struct HostHeader { pub msg_logs: logging::LogStrategy, } impl Decode for HostHeader { - async fn decode(mut read: Pin<&mut R>) -> Self { + async fn decode(mut read: Pin<&mut R>) -> Self { read_exact(read.as_mut(), HOST_INTRO).await; Self { log_strategy: logging::LogStrategy::decode(read.as_mut()).await, @@ -45,7 +45,7 @@ impl Decode for HostHeader { } } impl Encode for HostHeader { - async fn encode(&self, mut write: Pin<&mut W>) { + async fn encode(&self, mut write: Pin<&mut W>) { write_exact(write.as_mut(), HOST_INTRO).await; self.log_strategy.encode(write.as_mut()).await; self.msg_logs.encode(write.as_mut()).await @@ -58,13 +58,13 @@ pub struct ExtensionHeader { pub systems: Vec, } impl Decode for ExtensionHeader { - async fn decode(mut read: Pin<&mut R>) -> Self { + async fn decode(mut read: Pin<&mut R>) -> Self { read_exact(read.as_mut(), EXT_INTRO).await; Self { name: String::decode(read.as_mut()).await, systems: Vec::decode(read).await } } } impl Encode for ExtensionHeader { - async fn encode(&self, mut write: Pin<&mut W>) { + async fn encode(&self, mut write: Pin<&mut W>) { write_exact(write.as_mut(), EXT_INTRO).await; self.name.encode(write.as_mut()).await; self.systems.encode(write).await diff --git a/orchid-base/Cargo.toml b/orchid-base/Cargo.toml index 8f97da7..e539421 100644 --- a/orchid-base/Cargo.toml +++ b/orchid-base/Cargo.toml @@ -7,12 +7,11 @@ edition = "2024" [dependencies] async-once-cell = "0.5.4" -async-std = "1.13.0" async-stream = "0.3.6" derive_destructure = "1.0.0" -dyn-clone = "1.0.17" -futures = "0.3.31" -hashbrown = "0.15.2" +dyn-clone = "1.0.20" +futures = { version = "0.3.31", features = ["std"] } +hashbrown = "0.16.0" itertools = "0.14.0" lazy_static = "1.5.0" never = "0.1.0" @@ -21,9 +20,9 @@ orchid-api = { version = "0.1.0", path = "../orchid-api" } orchid-api-derive = { version = "0.1.0", path = "../orchid-api-derive" } orchid-api-traits = { version = "0.1.0", path = "../orchid-api-traits" } ordered-float = "5.0.0" -regex = "1.11.1" -rust-embed = "8.5.0" -some_executor = "0.4.0" +regex = "1.11.2" +rust-embed = "8.7.2" +some_executor = "0.6.1" substack = "1.1.1" -test_executors = "0.3.2" +test_executors = "0.3.5" trait-set = "0.3.0" diff --git a/orchid-base/src/error.rs b/orchid-base/src/error.rs index 5308232..4d127c6 100644 --- a/orchid-base/src/error.rs +++ b/orchid-base/src/error.rs @@ -209,7 +209,7 @@ pub fn mk_errv>( } pub async fn async_io_err>( - err: async_std::io::Error, + err: std::io::Error, i: &Interner, posv: impl IntoIterator, ) -> OrcErrv { diff --git a/orchid-base/src/interner.rs b/orchid-base/src/interner.rs index 6e70360..7e1e0b7 100644 --- a/orchid-base/src/interner.rs +++ b/orchid-base/src/interner.rs @@ -7,7 +7,7 @@ use std::rc::Rc; use std::sync::atomic; use std::{fmt, hash}; -use async_std::sync::Mutex; +use futures::lock::Mutex; use hashbrown::{HashMap, HashSet}; use itertools::Itertools as _; use orchid_api_traits::Request; diff --git a/orchid-base/src/msg.rs b/orchid-base/src/msg.rs index 80fda1d..c61a988 100644 --- a/orchid-base/src/msg.rs +++ b/orchid-base/src/msg.rs @@ -1,10 +1,10 @@ use std::io; use std::pin::Pin; -use async_std::io::{Read, ReadExt, Write, WriteExt}; +use futures::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt}; use orchid_api_traits::{Decode, Encode}; -pub async fn send_msg(mut write: Pin<&mut impl Write>, msg: &[u8]) -> io::Result<()> { +pub async fn send_msg(mut write: Pin<&mut impl AsyncWrite>, msg: &[u8]) -> io::Result<()> { let mut len_buf = vec![]; u32::try_from(msg.len()).unwrap().encode(Pin::new(&mut len_buf)).await; write.write_all(&len_buf).await?; @@ -12,7 +12,7 @@ pub async fn send_msg(mut write: Pin<&mut impl Write>, msg: &[u8]) -> io::Result write.flush().await } -pub async fn recv_msg(mut read: Pin<&mut impl Read>) -> io::Result> { +pub async fn recv_msg(mut read: Pin<&mut impl AsyncRead>) -> io::Result> { let mut len_buf = [0u8; (u32::BITS / 8) as usize]; read.read_exact(&mut len_buf).await?; let len = u32::decode(Pin::new(&mut &len_buf[..])).await; diff --git a/orchid-base/src/reqnot.rs b/orchid-base/src/reqnot.rs index db27019..d7b6035 100644 --- a/orchid-base/src/reqnot.rs +++ b/orchid-base/src/reqnot.rs @@ -8,11 +8,12 @@ use std::pin::Pin; use std::sync::Arc; use std::sync::atomic::{AtomicBool, Ordering}; -use async_std::channel; -use async_std::sync::Mutex; use derive_destructure::destructure; use dyn_clone::{DynClone, clone_box}; +use futures::channel::mpsc; use futures::future::LocalBoxFuture; +use futures::lock::Mutex; +use futures::{SinkExt, StreamExt}; use hashbrown::HashMap; use orchid_api_traits::{Channel, Coding, Decode, Encode, MsgSet, Request}; use trait_set::trait_set; @@ -102,7 +103,7 @@ pub struct ReqNotData { send: Box>, notif: Box>, req: Box>, - responses: HashMap>>, + responses: HashMap>>, } /// Wraps a raw message buffer to save on copying. @@ -144,7 +145,7 @@ impl ReqNot { let notif_val = ::Notif::decode(Pin::new(&mut &payload[..])).await; notif_cb(notif_val, self.clone()).await } else if 0 < id.bitand(1 << 63) { - let sender = g.responses.remove(&!id).expect("Received response for invalid message"); + let mut sender = g.responses.remove(&!id).expect("Received response for invalid message"); sender.send(message.to_vec()).await.unwrap() } else { let message = ::Req::decode(Pin::new(&mut &payload[..])).await; @@ -205,13 +206,13 @@ impl DynRequester for ReqNot { g.id += 1; let mut buf = id.to_be_bytes().to_vec(); req.encode(Pin::new(&mut buf)).await; - let (send, recv) = channel::bounded(1); + let (send, mut recv) = mpsc::channel(1); g.responses.insert(id, send); let mut send = clone_box(&*g.send); mem::drop(g); let rn = self.clone(); send(&buf, rn).await; - let items = recv.recv().await; + let items = recv.next().await; RawReply(items.unwrap()) }) } @@ -249,8 +250,8 @@ mod test { use std::rc::Rc; use std::sync::Arc; - use async_std::sync::Mutex; use futures::FutureExt; + use futures::lock::Mutex; use orchid_api::LogStrategy; use orchid_api_derive::Coding; use orchid_api_traits::{Channel, Request}; diff --git a/orchid-extension/Cargo.toml b/orchid-extension/Cargo.toml index 99d02af..d22d897 100644 --- a/orchid-extension/Cargo.toml +++ b/orchid-extension/Cargo.toml @@ -6,28 +6,33 @@ edition = "2024" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -ahash = "0.8.11" +ahash = "0.8.12" +async-lock = "3.4.1" async-once-cell = "0.5.4" -async-std = "1.13.0" async-stream = "0.3.6" derive_destructure = "1.0.0" -dyn-clone = "1.0.17" -futures = "0.3.31" -hashbrown = "0.15.2" +dyn-clone = "1.0.20" +futures = { version = "0.3.31", features = ["std"] } +hashbrown = "0.16.0" include_dir = { version = "0.7.4", optional = true } itertools = "0.14.0" -konst = "0.3.16" +konst = "0.4.1" lazy_static = "1.5.0" memo-map = "0.3.3" never = "0.1.0" -once_cell = "1.20.2" +once_cell = "1.21.3" orchid-api = { version = "0.1.0", path = "../orchid-api" } orchid-api-derive = { version = "0.1.0", path = "../orchid-api-derive" } orchid-api-traits = { version = "0.1.0", path = "../orchid-api-traits" } orchid-base = { version = "0.1.0", path = "../orchid-base" } ordered-float = "5.0.0" -pastey = "0.1.0" -some_executor = "0.5.1" +pastey = "0.1.1" +some_executor = "0.6.1" substack = "1.1.1" -tokio = { version = "1.46.1", optional = true } +tokio = { version = "1.47.1", optional = true } +tokio-util = { version = "0.7.16", optional = true, features = ["compat"] } + trait-set = "0.3.0" + +[features] +tokio = ["dep:tokio", "dep:tokio-util"] diff --git a/orchid-extension/src/atom.rs b/orchid-extension/src/atom.rs index 663d190..69ca5fc 100644 --- a/orchid-extension/src/atom.rs +++ b/orchid-extension/src/atom.rs @@ -7,11 +7,9 @@ use std::pin::Pin; use std::rc::Rc; use ahash::HashMap; -use async_std::io::{Read, Write}; -use async_std::stream; use dyn_clone::{DynClone, clone_box}; use futures::future::LocalBoxFuture; -use futures::{FutureExt, StreamExt}; +use futures::{AsyncRead, AsyncWrite, FutureExt, StreamExt, stream}; use orchid_api_derive::Coding; use orchid_api_traits::{Coding, Decode, Encode, Request, enc_vec}; use orchid_base::clone; @@ -157,8 +155,8 @@ trait_set! { trait AtomReqCb = for<'a> Fn( &'a A, SysCtx, - Pin<&'a mut dyn Read>, - Pin<&'a mut dyn Write>, + Pin<&'a mut dyn AsyncRead>, + Pin<&'a mut dyn AsyncWrite>, ) -> LocalBoxFuture<'a, ()> } @@ -173,17 +171,19 @@ impl MethodSetBuilder { assert!(!M::NAME.is_empty(), "AtomMethod::NAME cannoot be empty"); self.handlers.push(( M::NAME, - Rc::new(move |a: &A, ctx: SysCtx, req: Pin<&mut dyn Read>, rep: Pin<&mut dyn Write>| { - async { Supports::::handle(a, ctx, M::decode(req).await).await.encode(rep).await } - .boxed_local() - }), + Rc::new( + move |a: &A, ctx: SysCtx, req: Pin<&mut dyn AsyncRead>, rep: Pin<&mut dyn AsyncWrite>| { + async { Supports::::handle(a, ctx, M::decode(req).await).await.encode(rep).await } + .boxed_local() + }, + ), )); self } pub async fn pack(&self, ctx: SysCtx) -> MethodSet { MethodSet { - handlers: stream::from_iter(self.handlers.iter()) + handlers: stream::iter(self.handlers.iter()) .then(|(k, v)| { clone!(ctx; async move { (Sym::parse(k, ctx.i()).await.unwrap(), v.clone()) @@ -204,8 +204,8 @@ impl MethodSet { atom: &'a A, ctx: SysCtx, key: Sym, - req: Pin<&'a mut dyn Read>, - rep: Pin<&'a mut dyn Write>, + req: Pin<&'a mut dyn AsyncRead>, + rep: Pin<&'a mut dyn AsyncWrite>, ) -> bool { match self.handlers.get(&key) { None => false, @@ -286,14 +286,14 @@ pub trait AtomDynfo: 'static { &'a self, ctx: AtomCtx<'a>, key: Sym, - req: Pin<&'b mut dyn Read>, - rep: Pin<&'c mut dyn Write>, + req: Pin<&'b mut dyn AsyncRead>, + rep: Pin<&'c mut dyn AsyncWrite>, ) -> LocalBoxFuture<'a, bool>; fn command<'a>(&'a self, ctx: AtomCtx<'a>) -> LocalBoxFuture<'a, OrcRes>>; fn serialize<'a, 'b: 'a>( &'a self, ctx: AtomCtx<'a>, - write: Pin<&'b mut dyn Write>, + write: Pin<&'b mut dyn AsyncWrite>, ) -> LocalBoxFuture<'a, Option>>; fn deserialize<'a>( &'a self, diff --git a/orchid-extension/src/atom_owned.rs b/orchid-extension/src/atom_owned.rs index 5fef7cd..afd938e 100644 --- a/orchid-extension/src/atom_owned.rs +++ b/orchid-extension/src/atom_owned.rs @@ -6,11 +6,10 @@ use std::ops::Deref; use std::pin::Pin; use std::sync::atomic::AtomicU64; +use async_lock::{RwLock, RwLockReadGuard}; use async_once_cell::OnceCell; -use async_std::io::{Read, Write}; -use async_std::sync::{RwLock, RwLockReadGuard}; -use futures::FutureExt; use futures::future::{LocalBoxFuture, ready}; +use futures::{AsyncRead, AsyncWrite, FutureExt}; use itertools::Itertools; use memo_map::MemoMap; use never::Never; @@ -105,8 +104,8 @@ impl AtomDynfo for OwnedAtomDynfo { &'a self, AtomCtx(_, id, ctx): AtomCtx, key: Sym, - req: Pin<&'b mut dyn Read>, - rep: Pin<&'c mut dyn Write>, + req: Pin<&'b mut dyn AsyncRead>, + rep: Pin<&'c mut dyn AsyncWrite>, ) -> LocalBoxFuture<'a, bool> { Box::pin(async move { let a = AtomReadGuard::new(id.unwrap(), &ctx).await; @@ -126,7 +125,7 @@ impl AtomDynfo for OwnedAtomDynfo { fn serialize<'a, 'b: 'a>( &'a self, AtomCtx(_, id, ctx): AtomCtx<'a>, - mut write: Pin<&'b mut dyn Write>, + mut write: Pin<&'b mut dyn AsyncWrite>, ) -> LocalBoxFuture<'a, Option>> { Box::pin(async move { let id = id.unwrap(); @@ -241,7 +240,7 @@ pub trait OwnedAtom: Atomic + Any + Clone + 'static { fn serialize( &self, ctx: SysCtx, - write: Pin<&mut (impl Write + ?Sized)>, + write: Pin<&mut (impl AsyncWrite + ?Sized)>, ) -> impl Future { assert_serializable::(); async { panic!("Either implement serialize or set Refs to Never for {}", type_name::()) } @@ -263,7 +262,7 @@ fn assert_serializable() { pub trait DynOwnedAtom: 'static { fn atom_tid(&self) -> TypeId; fn as_any_ref(&self) -> &dyn Any; - fn encode<'a>(&'a self, buffer: Pin<&'a mut dyn Write>) -> LocalBoxFuture<'a, ()>; + fn encode<'a>(&'a self, buffer: Pin<&'a mut dyn AsyncWrite>) -> LocalBoxFuture<'a, ()>; fn dyn_call_ref(&self, arg: Expr) -> LocalBoxFuture<'_, GExpr>; fn dyn_call(self: Box, arg: Expr) -> LocalBoxFuture<'static, GExpr>; fn dyn_command(self: Box, ctx: SysCtx) -> LocalBoxFuture<'static, OrcRes>>; @@ -272,13 +271,13 @@ pub trait DynOwnedAtom: 'static { fn dyn_serialize<'a>( &'a self, ctx: SysCtx, - sink: Pin<&'a mut dyn Write>, + sink: Pin<&'a mut dyn AsyncWrite>, ) -> LocalBoxFuture<'a, Option>>; } impl DynOwnedAtom for T { fn atom_tid(&self) -> TypeId { TypeId::of::() } fn as_any_ref(&self) -> &dyn Any { self } - fn encode<'a>(&'a self, buffer: Pin<&'a mut dyn Write>) -> LocalBoxFuture<'a, ()> { + fn encode<'a>(&'a self, buffer: Pin<&'a mut dyn AsyncWrite>) -> LocalBoxFuture<'a, ()> { async { self.val().await.as_ref().encode(buffer).await }.boxed_local() } fn dyn_call_ref(&self, arg: Expr) -> LocalBoxFuture<'_, GExpr> { @@ -299,7 +298,7 @@ impl DynOwnedAtom for T { fn dyn_serialize<'a>( &'a self, ctx: SysCtx, - sink: Pin<&'a mut dyn Write>, + sink: Pin<&'a mut dyn AsyncWrite>, ) -> LocalBoxFuture<'a, Option>> { match TypeId::of::() == TypeId::of::<::Refs>() { true => ready(None).boxed_local(), diff --git a/orchid-extension/src/atom_thin.rs b/orchid-extension/src/atom_thin.rs index 5ec16d5..be76d9d 100644 --- a/orchid-extension/src/atom_thin.rs +++ b/orchid-extension/src/atom_thin.rs @@ -3,9 +3,8 @@ use std::future::Future; use std::pin::Pin; use async_once_cell::OnceCell; -use async_std::io::{Read, Write}; -use futures::FutureExt; use futures::future::LocalBoxFuture; +use futures::{AsyncRead, AsyncWrite, FutureExt}; use orchid_api_traits::{Coding, enc_vec}; use orchid_base::error::OrcRes; use orchid_base::format::FmtUnit; @@ -59,8 +58,8 @@ impl AtomDynfo for ThinAtomDynfo { &'a self, AtomCtx(buf, _, sys): AtomCtx<'a>, key: Sym, - req: Pin<&'m1 mut dyn Read>, - rep: Pin<&'m2 mut dyn Write>, + req: Pin<&'m1 mut dyn AsyncRead>, + rep: Pin<&'m2 mut dyn AsyncWrite>, ) -> LocalBoxFuture<'a, bool> { Box::pin(async move { let ms = self.ms.get_or_init(self.msbuild.pack(sys.clone())).await; @@ -76,7 +75,7 @@ impl AtomDynfo for ThinAtomDynfo { fn serialize<'a, 'b: 'a>( &'a self, ctx: AtomCtx<'a>, - write: Pin<&'b mut dyn Write>, + write: Pin<&'b mut dyn AsyncWrite>, ) -> LocalBoxFuture<'a, Option>> { Box::pin(async { T::decode(Pin::new(&mut &ctx.0[..])).await.encode(write).await; diff --git a/orchid-extension/src/coroutine_exec.rs b/orchid-extension/src/coroutine_exec.rs index e52f99f..bf56ca6 100644 --- a/orchid-extension/src/coroutine_exec.rs +++ b/orchid-extension/src/coroutine_exec.rs @@ -3,10 +3,10 @@ use std::marker::PhantomData; use std::pin::Pin; use std::rc::Rc; -use async_std::channel::{Receiver, RecvError, Sender, bounded}; -use async_std::sync::Mutex; +use futures::channel::mpsc::{Receiver, Sender, channel}; use futures::future::Fuse; -use futures::{FutureExt, select}; +use futures::lock::Mutex; +use futures::{FutureExt, SinkExt, StreamExt, select}; use never::Never; use orchid_base::error::OrcRes; @@ -22,20 +22,20 @@ enum Command { } struct BuilderCoroutineData { - work: Mutex>>>>, + work: Fuse>>>, cmd_recv: Receiver, } #[derive(Clone)] -struct BuilderCoroutine(Rc); +struct BuilderCoroutine(Rc>); impl BuilderCoroutine { pub async fn run(self) -> GExpr { let cmd = { - let mut work = self.0.work.lock().await; + let this = &mut *self.0.lock().await; select! { - ret_val = &mut *work => { return ret_val }, - cmd_res = self.0.cmd_recv.recv().fuse() => match cmd_res { - Ok(cmd) => cmd, - Err(RecvError) => return (&mut *work).await + ret_val = &mut this.work => { return ret_val }, + cmd_res = this.cmd_recv.next().fuse() => match cmd_res { + Some(cmd) => cmd, + None => return (&mut this.work).await }, } }; @@ -65,17 +65,17 @@ impl Atomic for Replier { impl OwnedAtom for Replier { type Refs = Never; async fn val(&self) -> Cow<'_, Self::Data> { Cow::Owned(()) } - async fn call(self, arg: Expr) -> GExpr { + async fn call(mut self, arg: Expr) -> GExpr { let _ = self.reply.send(arg).await; self.builder.run().await } } pub async fn exec(f: impl for<'a> AsyncFnOnce(ExecHandle<'a>) -> R + 'static) -> GExpr { - let (cmd_snd, cmd_recv) = bounded(1); + let (cmd_snd, cmd_recv) = channel(0); let work = async { f(ExecHandle(cmd_snd, PhantomData)).await.to_expr().await }.boxed_local().fuse(); - let coro = BuilderCoroutine(Rc::new(BuilderCoroutineData { cmd_recv, work: Mutex::new(work) })); + let coro = BuilderCoroutine(Rc::new(Mutex::new(BuilderCoroutineData { cmd_recv, work }))); coro.run().await } @@ -84,13 +84,13 @@ static WEIRD_DROP_ERR: &str = "Coroutine dropped while we are being polled someh pub struct ExecHandle<'a>(Sender, PhantomData<&'a ()>); impl ExecHandle<'_> { pub async fn exec(&mut self, val: impl ToExpr) -> OrcRes { - let (reply_snd, reply_recv) = bounded(1); + let (reply_snd, mut reply_recv) = channel(0); self.0.send(Command::Execute(val.to_expr().await, reply_snd)).await.expect(WEIRD_DROP_ERR); - T::try_from_expr(reply_recv.recv().await.expect(WEIRD_DROP_ERR)).await + T::try_from_expr(reply_recv.next().await.expect(WEIRD_DROP_ERR)).await } pub async fn register(&mut self, val: impl ToExpr) -> Expr { - let (reply_snd, reply_recv) = bounded(1); + let (reply_snd, mut reply_recv) = channel(0); self.0.send(Command::Register(val.to_expr().await, reply_snd)).await.expect(WEIRD_DROP_ERR); - reply_recv.recv().await.expect(WEIRD_DROP_ERR) + reply_recv.next().await.expect(WEIRD_DROP_ERR) } } diff --git a/orchid-extension/src/entrypoint.rs b/orchid-extension/src/entrypoint.rs index 0942fb9..7e93a83 100644 --- a/orchid-extension/src/entrypoint.rs +++ b/orchid-extension/src/entrypoint.rs @@ -5,11 +5,10 @@ use std::num::NonZero; use std::pin::Pin; use std::rc::Rc; -use async_std::channel::{self, Receiver, Sender}; -use async_std::stream; -use async_std::sync::Mutex; +use futures::channel::mpsc::{Receiver, Sender, channel}; use futures::future::{LocalBoxFuture, join_all}; -use futures::{FutureExt, StreamExt, stream_select}; +use futures::lock::Mutex; +use futures::{FutureExt, SinkExt, StreamExt, stream, stream_select}; use hashbrown::HashMap; use itertools::Itertools; use orchid_api::{ExtMsgSet, IntReq}; @@ -85,16 +84,16 @@ pub async fn with_atom_record<'a, F: Future, T>( pub struct ExtensionOwner { _interner_cell: Rc>>, _systems_lock: Rc>>, - out_recv: Receiver>, + out_recv: Mutex>>, out_send: Sender>, } impl ExtPort for ExtensionOwner { fn send<'a>(&'a self, msg: &'a [u8]) -> LocalBoxFuture<'a, ()> { - Box::pin(async { self.out_send.send(msg.to_vec()).boxed_local().await.unwrap() }) + Box::pin(async { self.out_send.clone().send(msg.to_vec()).boxed_local().await.unwrap() }) } fn recv(&self) -> LocalBoxFuture<'_, Option>> { - Box::pin(async { (self.out_recv.recv().await).ok() }) + Box::pin(async { self.out_recv.lock().await.next().await }) } } @@ -110,9 +109,9 @@ pub fn extension_init( .collect_vec(); let systems_lock = Rc::new(Mutex::new(HashMap::::new())); let ext_header = api::ExtensionHeader { name: data.name.to_string(), systems: decls.clone() }; - let (out_send, in_recv) = channel::bounded::>(1); - let (in_send, out_recv) = channel::bounded::>(1); - let (exit_send, exit_recv) = channel::bounded(1); + let (out_send, in_recv) = channel::>(1); + let (in_send, out_recv) = channel::>(1); + let (exit_send, exit_recv) = channel(1); let logger = Logger::new(log_strategy); let msg_logger = Logger::new(msg_logs); let interner_cell = Rc::new(RefCell::new(None::)); @@ -136,22 +135,30 @@ pub fn extension_init( }; let rn = ReqNot::::new( msg_logger.clone(), - move |a, _| clone!(in_send; Box::pin(async move { in_send.send(a.to_vec()).await.unwrap() })), - clone!(systems_weak, exit_send, get_ctx; move |n, _| { - clone!(systems_weak, exit_send, get_ctx; async move { - match n { - api::HostExtNotif::Exit => exit_send.send(()).await.unwrap(), - api::HostExtNotif::SystemDrop(api::SystemDrop(sys_id)) => - if let Some(rc) = systems_weak.upgrade() { - mem::drop(rc.lock().await.remove(&sys_id)) + move |a, _| { + clone!(in_send mut); + Box::pin(async move { in_send.send(a.to_vec()).await.unwrap() }) + }, + { + clone!(systems_weak, exit_send, get_ctx); + move |n, _| { + clone!(systems_weak, exit_send mut, get_ctx); + async move { + match n { + api::HostExtNotif::Exit => exit_send.send(()).await.unwrap(), + api::HostExtNotif::SystemDrop(api::SystemDrop(sys_id)) => + if let Some(rc) = systems_weak.upgrade() { + mem::drop(rc.lock().await.remove(&sys_id)) + }, + api::HostExtNotif::AtomDrop(api::AtomDrop(sys_id, atom)) => { + let ctx = get_ctx(sys_id).await; + take_atom(atom, &ctx).await.dyn_free(ctx.clone()).await }, - api::HostExtNotif::AtomDrop(api::AtomDrop(sys_id, atom)) => { - let ctx = get_ctx(sys_id).await; - take_atom(atom, &ctx).await.dyn_free(ctx.clone()).await } } - }.boxed_local()) - }), + .boxed_local() + } + }, { clone!(logger, get_ctx, init_ctx, systems_weak, interner_weak, decls, msg_logger); move |hand, req| { @@ -174,7 +181,7 @@ pub fn extension_init( }); let lazy_mems = Mutex::new(HashMap::new()); let ctx = init_ctx(new_sys.id, cted.clone(), hand.reqnot()).await; - let const_root = stream::from_iter(cted.inst().dyn_env()) + let const_root = stream::iter(cted.inst().dyn_env()) .then(|mem| { let (req, lazy_mems) = (&hand, &lazy_mems); clone!(i, ctx; async move { @@ -375,7 +382,7 @@ pub fn extension_init( ExtInit { header: ext_header, port: Box::new(ExtensionOwner { - out_recv, + out_recv: Mutex::new(out_recv), out_send, _interner_cell: interner_cell, _systems_lock: systems_lock, diff --git a/orchid-extension/src/func_atom.rs b/orchid-extension/src/func_atom.rs index a85d503..b62bc1c 100644 --- a/orchid-extension/src/func_atom.rs +++ b/orchid-extension/src/func_atom.rs @@ -10,10 +10,9 @@ use std::future::Future; use std::pin::Pin; use std::rc::Rc; -use async_std::io::Write; -use async_std::sync::Mutex; -use futures::FutureExt; use futures::future::LocalBoxFuture; +use futures::lock::Mutex; +use futures::{AsyncWrite, FutureExt}; use itertools::Itertools; use never::Never; use orchid_api_traits::Encode; @@ -111,7 +110,7 @@ impl OwnedAtom for Fun { } } async fn call(self, arg: Expr) -> GExpr { self.call_ref(arg).await } - async fn serialize(&self, _: SysCtx, write: Pin<&mut (impl Write + ?Sized)>) -> Self::Refs { + async fn serialize(&self, _: SysCtx, write: Pin<&mut (impl AsyncWrite + ?Sized)>) -> Self::Refs { self.path.to_api().encode(write).await; self.args.clone() } diff --git a/orchid-extension/src/lib.rs b/orchid-extension/src/lib.rs index 899f567..8e16689 100644 --- a/orchid-extension/src/lib.rs +++ b/orchid-extension/src/lib.rs @@ -10,7 +10,7 @@ pub mod expr; pub mod func_atom; pub mod gen_expr; pub mod lexer; -pub mod msg; +// pub mod msg; pub mod other_system; pub mod parser; pub mod reflection; diff --git a/orchid-extension/src/msg.rs b/orchid-extension/src/msg.rs index 07da0ac..4c01e1b 100644 --- a/orchid-extension/src/msg.rs +++ b/orchid-extension/src/msg.rs @@ -1,12 +1,9 @@ use std::pin::pin; use async_once_cell::OnceCell; -use async_std::io::{self, Stdout}; -use async_std::sync::Mutex; +use futures::lock::Mutex; use orchid_base::msg::{recv_msg, send_msg}; -static STDOUT: OnceCell> = OnceCell::new(); - pub async fn send_parent_msg(msg: &[u8]) -> io::Result<()> { let stdout_lk = STDOUT.get_or_init(async { Mutex::new(io::stdout()) }).await; let mut stdout_g = stdout_lk.lock().await; diff --git a/orchid-extension/src/reflection.rs b/orchid-extension/src/reflection.rs index 366bb1c..1d000f3 100644 --- a/orchid-extension/src/reflection.rs +++ b/orchid-extension/src/reflection.rs @@ -1,8 +1,8 @@ use std::cell::OnceCell; use std::rc::Rc; -use async_std::sync::Mutex; use futures::FutureExt; +use futures::lock::Mutex; use memo_map::MemoMap; use orchid_base::interner::Tok; use orchid_base::name::{NameLike, VPath}; diff --git a/orchid-extension/src/system_ctor.rs b/orchid-extension/src/system_ctor.rs index b08df93..3d95fc8 100644 --- a/orchid-extension/src/system_ctor.rs +++ b/orchid-extension/src/system_ctor.rs @@ -62,7 +62,7 @@ pub trait SystemCtor: Send + Sync + 'static { type Instance: System; const NAME: &'static str; const VERSION: f64; - fn inst() -> Option; + fn inst(deps: ::Sat) -> Self::Instance; } pub trait DynSystemCtor: Send + Sync + 'static { @@ -81,8 +81,8 @@ impl DynSystemCtor for T { } fn new_system(&self, api::NewSystem { system: _, id: _, depends }: &api::NewSystem) -> CtedObj { let mut ids = depends.iter().copied(); - let inst = Arc::new(T::inst().expect("Constructor did not create system")); let deps = T::Deps::create(&mut || ids.next().unwrap()); + let inst = Arc::new(T::inst(deps.clone())); Arc::new(Cted:: { deps, inst }) } } diff --git a/orchid-extension/src/tokio.rs b/orchid-extension/src/tokio.rs index 0257dde..37ed5ae 100644 --- a/orchid-extension/src/tokio.rs +++ b/orchid-extension/src/tokio.rs @@ -4,23 +4,27 @@ use crate::entrypoint::ExtensionData; pub async fn tokio_main(data: ExtensionData) { use std::io::Write; use std::mem; - use std::pin::Pin; + use std::pin::{Pin, pin}; use std::rc::Rc; - use async_std::io; + use async_once_cell::OnceCell; use futures::StreamExt; use futures::future::LocalBoxFuture; + use futures::lock::Mutex; use futures::stream::FuturesUnordered; use orchid_api_traits::{Decode, Encode}; + use orchid_base::msg::{recv_msg, send_msg}; + use tokio::io; + use tokio::io::Stdout; use tokio::task::{LocalSet, spawn_local}; + use tokio_util::compat::{Compat, TokioAsyncReadCompatExt, TokioAsyncWriteCompatExt}; use crate::api; use crate::entrypoint::extension_init; - use crate::msg::{recv_parent_msg, send_parent_msg}; let local_set = LocalSet::new(); local_set.spawn_local(async { - let host_header = api::HostHeader::decode(Pin::new(&mut async_std::io::stdin())).await; + let host_header = api::HostHeader::decode(Pin::new(&mut tokio::io::stdin().compat())).await; let init = Rc::new(extension_init(data, host_header, Rc::new(|fut| mem::drop(spawn_local(fut))))); let mut buf = Vec::new(); @@ -32,7 +36,7 @@ pub async fn tokio_main(data: ExtensionData) { let mut io = FuturesUnordered::>::new(); io.push(Box::pin(async { loop { - match recv_parent_msg().await { + match recv_msg(pin!(io::stdin().compat())).await { Ok(msg) => init.send(&msg[..]).await, Err(e) if e.kind() == io::ErrorKind::BrokenPipe => break, Err(e) if e.kind() == io::ErrorKind::UnexpectedEof => break, @@ -42,7 +46,10 @@ pub async fn tokio_main(data: ExtensionData) { })); io.push(Box::pin(async { while let Some(msg) = init.recv().await { - send_parent_msg(&msg[..]).await.unwrap(); + static STDOUT: OnceCell>> = OnceCell::new(); + let stdout_lk = STDOUT.get_or_init(async { Mutex::new(io::stdout().compat_write()) }).await; + let mut stdout_g = stdout_lk.lock().await; + send_msg(pin!(&mut *stdout_g), &msg[..]).await.expect("Parent pipe broken"); } })); io.next().await; diff --git a/orchid-host/Cargo.toml b/orchid-host/Cargo.toml index 340c8cc..8b92a6e 100644 --- a/orchid-host/Cargo.toml +++ b/orchid-host/Cargo.toml @@ -6,14 +6,14 @@ edition = "2024" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +async-lock = "3.4.1" async-once-cell = "0.5.4" -async-process = "2.3.0" -async-std = "1.13.0" +async-process = "2.4.0" async-stream = "0.3.6" bound = "0.6.0" derive_destructure = "1.0.0" -futures = "0.3.31" -hashbrown = "0.15.2" +futures = { version = "0.3.31", features = ["std"] } +hashbrown = "0.16.0" itertools = "0.14.0" lazy_static = "1.5.0" memo-map = "0.3.3" @@ -23,7 +23,7 @@ orchid-api = { version = "0.1.0", path = "../orchid-api" } orchid-api-traits = { version = "0.1.0", path = "../orchid-api-traits" } orchid-base = { version = "0.1.0", path = "../orchid-base" } ordered-float = "5.0.0" -paste = "1.0.15" +pastey = "0.1.1" substack = "1.1.1" -test_executors = "0.3.2" +test_executors = "0.3.5" trait-set = "0.3.0" diff --git a/orchid-host/src/ctx.rs b/orchid-host/src/ctx.rs index 7aab895..bb517bd 100644 --- a/orchid-host/src/ctx.rs +++ b/orchid-host/src/ctx.rs @@ -3,7 +3,7 @@ use std::num::{NonZero, NonZeroU16}; use std::rc::{Rc, Weak}; use std::{fmt, ops}; -use async_std::sync::RwLock; +use async_lock::RwLock; use hashbrown::HashMap; use orchid_api::SysId; use orchid_base::builtin::Spawner; diff --git a/orchid-host/src/execute.rs b/orchid-host/src/execute.rs index 038cd26..80b67a1 100644 --- a/orchid-host/src/execute.rs +++ b/orchid-host/src/execute.rs @@ -1,6 +1,6 @@ use std::mem; -use async_std::sync::RwLockWriteGuard; +use async_lock::RwLockWriteGuard; use bound::Bound; use futures::FutureExt; use orchid_base::error::OrcErrv; diff --git a/orchid-host/src/expr.rs b/orchid-host/src/expr.rs index fd82f65..5d76c93 100644 --- a/orchid-host/src/expr.rs +++ b/orchid-host/src/expr.rs @@ -4,7 +4,7 @@ use std::num::NonZeroU64; use std::rc::{Rc, Weak}; use std::{fmt, mem}; -use async_std::sync::RwLock; +use async_lock::RwLock; use futures::FutureExt; use hashbrown::HashSet; use itertools::Itertools; diff --git a/orchid-host/src/extension.rs b/orchid-host/src/extension.rs index 1cb3f32..e810082 100644 --- a/orchid-host/src/extension.rs +++ b/orchid-host/src/extension.rs @@ -5,12 +5,12 @@ use std::num::NonZeroU64; use std::pin::pin; use std::rc::{Rc, Weak}; -use async_std::channel::{self, Sender}; -use async_std::sync::Mutex; use async_stream::stream; use derive_destructure::destructure; +use futures::channel::mpsc::{Sender, channel}; use futures::future::{join, join_all}; -use futures::{StreamExt, stream}; +use futures::lock::Mutex; +use futures::{SinkExt, StreamExt, stream}; use hashbrown::HashMap; use itertools::Itertools; use orchid_api_traits::Request; @@ -45,12 +45,12 @@ pub struct ExtensionData { next_pars: RefCell, exprs: ExprStore, exiting_snd: Sender<()>, - lex_recur: Mutex>>>, + lex_recur: Mutex>>>, } impl Drop for ExtensionData { fn drop(&mut self) { let reqnot = self.reqnot.clone(); - let exiting_snd = self.exiting_snd.clone(); + let mut exiting_snd = self.exiting_snd.clone(); (self.ctx.spawn)(Box::pin(async move { reqnot.notify(api::HostExtNotif::Exit).await; exiting_snd.send(()).await.unwrap() @@ -64,7 +64,7 @@ impl Extension { pub fn new(init: ExtInit, logger: Logger, msg_logger: Logger, ctx: Ctx) -> io::Result { Ok(Self(Rc::new_cyclic(|weak: &Weak| { let init = Rc::new(init); - let (exiting_snd, exiting_rcv) = channel::bounded::<()>(1); + let (exiting_snd, exiting_rcv) = channel::<()>(0); (ctx.spawn)(clone!(init, weak, ctx; Box::pin(async move { let rcv_stream = stream! { loop { yield init.recv().await } }; let mut event_stream = pin!(stream::select(exiting_rcv.map(|()| None), rcv_stream)); @@ -147,13 +147,14 @@ impl Extension { hand.handle(fw, &sys.request(body.clone()).await).await }, api::ExtHostReq::SubLex(sl) => { - let (rep_in, rep_out) = channel::bounded(1); + let (rep_in, mut rep_out) = channel(0); { let lex_g = this.0.lex_recur.lock().await; - let req_in = lex_g.get(&sl.id).expect("Sublex for nonexistent lexid"); + let mut req_in = + lex_g.get(&sl.id).cloned().expect("Sublex for nonexistent lexid"); req_in.send(ReqPair(sl.clone(), rep_in)).await.unwrap(); } - hand.handle(&sl, &rep_out.recv().await.unwrap()).await + hand.handle(&sl, &rep_out.next().await.unwrap()).await }, api::ExtHostReq::ExprReq(api::ExprReq::Inspect( ins @ api::Inspect { target }, @@ -265,7 +266,7 @@ impl Extension { // get unique lex ID let id = api::ParsId(self.next_pars()); // create and register channel - let (req_in, req_out) = channel::bounded(1); + let (req_in, mut req_out) = channel(0); self.0.lex_recur.lock().await.insert(id, req_in); // lex_recur released let (ret, ()) = join( async { @@ -277,7 +278,7 @@ impl Extension { res }, async { - while let Ok(ReqPair(sublex, rep_in)) = req_out.recv().await { + while let Some(ReqPair(sublex, mut rep_in)) = req_out.next().await { (rep_in.send(r(sublex.pos).await).await) .expect("Response channel dropped while request pending") } diff --git a/orchid-host/src/lex.rs b/orchid-host/src/lex.rs index 4ab1a0a..423b5bc 100644 --- a/orchid-host/src/lex.rs +++ b/orchid-host/src/lex.rs @@ -1,7 +1,7 @@ use std::rc::Rc; -use async_std::sync::Mutex; use futures::FutureExt; +use futures::lock::Mutex; use orchid_base::error::{OrcErrv, OrcRes, mk_errv}; use orchid_base::interner::Tok; use orchid_base::location::SrcRange; diff --git a/orchid-host/src/subprocess.rs b/orchid-host/src/subprocess.rs index 921f740..d367515 100644 --- a/orchid-host/src/subprocess.rs +++ b/orchid-host/src/subprocess.rs @@ -1,12 +1,12 @@ use std::cell::RefCell; -use std::io::Write; +use std::io::{self, Write}; use std::pin::Pin; use async_process::{self, Child, ChildStdin, ChildStdout}; -use async_std::io::{self, BufReadExt, BufReader}; -use async_std::sync::Mutex; -use futures::AsyncWriteExt; use futures::future::LocalBoxFuture; +use futures::io::BufReader; +use futures::lock::Mutex; +use futures::{self, AsyncBufReadExt, AsyncWriteExt}; use orchid_api_traits::{Decode, Encode}; use orchid_base::builtin::{ExtInit, ExtPort}; use orchid_base::logging::Logger; diff --git a/orchid-host/src/tree.rs b/orchid-host/src/tree.rs index 74a3b87..51b10e6 100644 --- a/orchid-host/src/tree.rs +++ b/orchid-host/src/tree.rs @@ -4,8 +4,8 @@ use std::cell::RefCell; use std::rc::{Rc, Weak}; use std::slice; +use async_lock::RwLock; use async_once_cell::OnceCell; -use async_std::sync::RwLock; use futures::{FutureExt, StreamExt, stream}; use hashbrown::HashMap; use hashbrown::hash_map::Entry; diff --git a/orchid-macros/Cargo.toml b/orchid-macros/Cargo.toml deleted file mode 100644 index 8a3314d..0000000 --- a/orchid-macros/Cargo.toml +++ /dev/null @@ -1,6 +0,0 @@ -[package] -name = "orchid-macros" -version = "0.1.0" -edition = "2024" - -[dependencies] diff --git a/orchid-macros/src/main.rs b/orchid-macros/src/main.rs deleted file mode 100644 index a30eb95..0000000 --- a/orchid-macros/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello, world!"); -} diff --git a/orchid-std/Cargo.toml b/orchid-std/Cargo.toml index 96acc4b..82b2af7 100644 --- a/orchid-std/Cargo.toml +++ b/orchid-std/Cargo.toml @@ -5,13 +5,12 @@ edition = "2024" [dependencies] async-once-cell = "0.5.4" -async-std = "1.13.0" async-stream = "0.3.6" -futures = "0.3.31" -hashbrown = "0.15.2" +futures = { version = "0.3.31", features = ["std"] } +hashbrown = "0.16.0" itertools = "0.14.0" never = "0.1.0" -once_cell = "1.20.2" +once_cell = "1.21.3" orchid-api = { version = "0.1.0", path = "../orchid-api" } orchid-api-derive = { version = "0.1.0", path = "../orchid-api-derive" } orchid-api-traits = { version = "0.1.0", path = "../orchid-api-traits" } @@ -20,9 +19,9 @@ orchid-extension = { version = "0.1.0", path = "../orchid-extension", features = "tokio", ] } ordered-float = "5.0.0" -rust_decimal = "1.36.0" +rust_decimal = "1.37.2" substack = "1.1.1" -tokio = { version = "1.43.0", features = ["full"] } +tokio = { version = "1.47.1", features = ["full"] } [dev-dependencies] -test_executors = "0.3.2" +test_executors = "0.3.5" diff --git a/orchid-std/src/macros/let_line.rs b/orchid-std/src/macros/let_line.rs index 3190b83..636049a 100644 --- a/orchid-std/src/macros/let_line.rs +++ b/orchid-std/src/macros/let_line.rs @@ -1,7 +1,6 @@ use std::pin::pin; -use async_std::stream; -use futures::{FutureExt, StreamExt}; +use futures::{FutureExt, StreamExt, stream}; use hashbrown::HashMap; use itertools::Itertools; use orchid_api::Paren; @@ -54,7 +53,7 @@ impl Parser for LetLine { pub async fn dealias_mac_v(aliased: Vec, ctx: &ConstCtx, rep: &Reporter) -> Vec { let keys = glossary_v(&aliased).collect_vec(); let mut names: HashMap<_, _> = HashMap::new(); - let mut stream = pin!(ctx.names(&keys).zip(stream::from_iter(&keys))); + let mut stream = pin!(ctx.names(&keys).zip(stream::iter(&keys))); while let Some((canonical, local)) = stream.next().await { match canonical { Err(e) => rep.report(e), @@ -91,7 +90,7 @@ pub async fn parse_tokv(line: PSnippet<'_>, ctx: &impl ParseCtx) -> Vec } async fn parse_tokv_no_lambdas(line: &[PTokTree], ctx: &impl ParseCtx) -> Vec { - stream::from_iter(line).filter_map(|tt| parse_tok(tt, ctx)).collect().await + stream::iter(line).filter_map(|tt| parse_tok(tt, ctx)).collect().await } pub async fn parse_tok(tree: &PTokTree, ctx: &impl ParseCtx) -> Option { diff --git a/orchid-std/src/macros/macro_line.rs b/orchid-std/src/macros/macro_line.rs index 08ef4b0..12c200a 100644 --- a/orchid-std/src/macros/macro_line.rs +++ b/orchid-std/src/macros/macro_line.rs @@ -3,8 +3,7 @@ use std::cell::RefCell; use std::rc::Rc; use async_once_cell::OnceCell; -use async_std::stream; -use futures::StreamExt; +use futures::{StreamExt, stream}; use hashbrown::{HashMap, HashSet}; use itertools::Itertools; use never::Never; @@ -159,7 +158,7 @@ impl Parser for MacroLine { .get_or_init(async { let rep = Reporter::new(); let rules = rules.borrow_mut().take().expect("once cell initializer runs"); - let rules = stream::from_iter(rules) + let rules = stream::iter(rules) .then(|(body_name, placeholders, index, pos, pattern_macv)| { let cctx = &cctx; let rep = &rep; @@ -182,7 +181,7 @@ impl Parser for MacroLine { } } }) - .flat_map(stream::from_iter) + .flat_map(stream::iter) .collect::>() .await; let own_kws = keywords.keys().cloned().collect_vec(); diff --git a/orchid-std/src/macros/macro_system.rs b/orchid-std/src/macros/macro_system.rs index 2443b82..69985ce 100644 --- a/orchid-std/src/macros/macro_system.rs +++ b/orchid-std/src/macros/macro_system.rs @@ -5,6 +5,7 @@ use orchid_base::reqnot::Receipt; use orchid_extension::atom::{AtomDynfo, AtomicFeatures}; use orchid_extension::entrypoint::ExtReq; use orchid_extension::lexer::LexerObj; +use orchid_extension::other_system::SystemHandle; use orchid_extension::parser::ParserObj; use orchid_extension::system::{System, SystemCard}; use orchid_extension::system_ctor::SystemCtor; @@ -13,7 +14,7 @@ use orchid_extension::tree::GenMember; use crate::macros::instantiate_tpl::InstantiateTplCall; use crate::macros::let_line::LetLine; use crate::macros::macro_lib::gen_macro_lib; -use crate::macros::macro_line::MacroLine; +use crate::macros::macro_line::{Macro, MacroLine}; use crate::macros::mactree_lexer::MacTreeLexer; use crate::macros::recur_state::RecurState; use crate::{MacTree, StdSystem}; @@ -25,13 +26,18 @@ impl SystemCtor for MacroSystem { type Instance = Self; const NAME: &'static str = "macros"; const VERSION: f64 = 0.00_01; - fn inst() -> Option { Some(Self) } + fn inst(_: SystemHandle) -> Self::Instance { Self } } impl SystemCard for MacroSystem { type Ctor = Self; type Req = Never; fn atoms() -> impl IntoIterator>> { - [Some(InstantiateTplCall::dynfo()), Some(MacTree::dynfo()), Some(RecurState::dynfo())] + [ + Some(InstantiateTplCall::dynfo()), + Some(MacTree::dynfo()), + Some(RecurState::dynfo()), + Some(Macro::dynfo()), + ] } } impl System for MacroSystem { diff --git a/orchid-std/src/std/std_system.rs b/orchid-std/src/std/std_system.rs index c3ad7f2..580db38 100644 --- a/orchid-std/src/std/std_system.rs +++ b/orchid-std/src/std/std_system.rs @@ -25,7 +25,7 @@ impl SystemCtor for StdSystem { type Instance = Self; const NAME: &'static str = "orchid::std"; const VERSION: f64 = 0.00_01; - fn inst() -> Option { Some(Self) } + fn inst(_: ()) -> Self::Instance { Self } } impl SystemCard for StdSystem { type Ctor = Self; diff --git a/orchid-std/src/std/string/str_atom.rs b/orchid-std/src/std/string/str_atom.rs index 21fe98c..8f828e1 100644 --- a/orchid-std/src/std/string/str_atom.rs +++ b/orchid-std/src/std/string/str_atom.rs @@ -3,7 +3,7 @@ use std::ops::Deref; use std::pin::Pin; use std::rc::Rc; -use async_std::io::Write; +use futures::AsyncWrite; use orchid_api_derive::Coding; use orchid_api_traits::{Encode, Request}; use orchid_base::error::{OrcRes, mk_errv}; @@ -46,7 +46,7 @@ impl Deref for StrAtom { impl OwnedAtom for StrAtom { type Refs = (); async fn val(&self) -> Cow<'_, Self::Data> { Cow::Owned(()) } - async fn serialize(&self, _: SysCtx, sink: Pin<&mut (impl Write + ?Sized)>) -> Self::Refs { + async fn serialize(&self, _: SysCtx, sink: Pin<&mut (impl AsyncWrite + ?Sized)>) -> Self::Refs { self.deref().encode(sink).await } async fn print_atom<'a>(&'a self, _: &'a (impl FmtCtx + ?Sized + 'a)) -> FmtUnit { @@ -72,7 +72,7 @@ impl OwnedAtom for IntStrAtom { async fn print_atom<'a>(&'a self, _: &'a (impl FmtCtx + ?Sized + 'a)) -> FmtUnit { format!("{:?}i", *self.0).into() } - async fn serialize(&self, _: SysCtx, write: Pin<&mut (impl Write + ?Sized)>) { + async fn serialize(&self, _: SysCtx, write: Pin<&mut (impl AsyncWrite + ?Sized)>) { self.0.encode(write).await } async fn deserialize(mut ctx: impl DeserializeCtx, _: ()) -> Self {