diff --git a/Cargo.lock b/Cargo.lock index f0b408b..7083a50 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11,152 +11,12 @@ dependencies = [ "memchr", ] -[[package]] -name = "anstyle" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" - [[package]] name = "anyhow" version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" -[[package]] -name = "aquamarine" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a941c39708478e8eea39243b5983f1c42d2717b3620ee91f4a52115fd02ac43f" -dependencies = [ - "itertools 0.9.0", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - -[[package]] -name = "autocfg" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" - -[[package]] -name = "autocxx" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ae6bbbec65d053b6fd803a4d63d21d0bd4a92f84f917847f216fec8bb8ae6ae" -dependencies = [ - "aquamarine", - "autocxx-macro", - "cxx", - "moveit", -] - -[[package]] -name = "autocxx-bindgen" -version = "0.73.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecaaf84d9cf1a772409c0abdac7d2477a31fd890dbdf606d8f684dc60129aa94" -dependencies = [ - "bitflags", - "cexpr", - "clang-sys", - "itertools 0.13.0", - "log", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn 2.0.117", -] - -[[package]] -name = "autocxx-build" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16fa879472d80dc40ca826a59347772b3f15e69a7a74df41c4935942f62cf30" -dependencies = [ - "autocxx-engine", - "env_logger", - "indexmap 1.9.3", - "syn 2.0.117", -] - -[[package]] -name = "autocxx-engine" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9866b109f7091a3470a49906d35c7f34597828be8885508e9395d1194f8283ca" -dependencies = [ - "aquamarine", - "autocxx-bindgen", - "autocxx-parser", - "cc", - "cxx-gen", - "indexmap 1.9.3", - "indoc", - "itertools 0.10.5", - "log", - "miette", - "once_cell", - "prettyplease", - "proc-macro2", - "quote", - "regex", - "regex_static", - "rustversion", - "serde_json", - "syn 2.0.117", - "tempfile", - "thiserror", - "version_check", -] - -[[package]] -name = "autocxx-macro" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c26712d744702e6fe61fdc618cc107a581a009ec8bfaffc67707d82501dbd907" -dependencies = [ - "autocxx-parser", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.117", -] - -[[package]] -name = "autocxx-parser" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bcfc473ec409e612fb0e0c5c4a1b5b7611eca2bac71bc27b3cda98f15a25124" -dependencies = [ - "indexmap 1.9.3", - "itertools 0.10.5", - "log", - "once_cell", - "proc-macro2", - "quote", - "serde", - "serde_json", - "syn 2.0.117", - "thiserror", -] - [[package]] name = "bindgen" version = "0.72.1" @@ -173,7 +33,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.117", + "syn", ] [[package]] @@ -218,43 +78,6 @@ dependencies = [ "libloading", ] -[[package]] -name = "clap" -version = "4.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b193af5b67834b676abd72466a96c1024e6a6ad978a1f484bd90b85c94041351" -dependencies = [ - "clap_builder", -] - -[[package]] -name = "clap_builder" -version = "4.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" -dependencies = [ - "anstyle", - "clap_lex", - "strsim", -] - -[[package]] -name = "clap_lex" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" - -[[package]] -name = "codespan-reporting" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681" -dependencies = [ - "serde", - "termcolor", - "unicode-width 0.2.2", -] - [[package]] name = "ctor" version = "0.6.3" @@ -271,81 +94,6 @@ version = "0.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52560adf09603e58c9a7ee1fe1dcb95a16927b17c127f0ac02d6e768a0e25bc1" -[[package]] -name = "cxx" -version = "1.0.194" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747d8437319e3a2f43d93b341c137927ca70c0f5dabeea7a005a73665e247c7e" -dependencies = [ - "cc", - "cxx-build", - "cxxbridge-cmd", - "cxxbridge-flags", - "cxxbridge-macro", - "foldhash 0.2.0", - "link-cplusplus", -] - -[[package]] -name = "cxx-build" -version = "1.0.194" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0f4697d190a142477b16aef7da8a99bfdc41e7e8b1687583c0d23a79c7afc1e" -dependencies = [ - "cc", - "codespan-reporting", - "indexmap 2.13.0", - "proc-macro2", - "quote", - "scratch", - "syn 2.0.117", -] - -[[package]] -name = "cxx-gen" -version = "0.7.194" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "035b6c61a944483e8a4b2ad4fb8b13830d63491bd004943716ad16d85dcc64bc" -dependencies = [ - "codespan-reporting", - "indexmap 2.13.0", - "proc-macro2", - "quote", - "syn 2.0.117", -] - -[[package]] -name = "cxxbridge-cmd" -version = "1.0.194" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0956799fa8678d4c50eed028f2de1c0552ae183c76e976cf7ca8c4e36a7c328" -dependencies = [ - "clap", - "codespan-reporting", - "indexmap 2.13.0", - "proc-macro2", - "quote", - "syn 2.0.117", -] - -[[package]] -name = "cxxbridge-flags" -version = "1.0.194" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23384a836ab4f0ad98ace7e3955ad2de39de42378ab487dc28d3990392cb283a" - -[[package]] -name = "cxxbridge-macro" -version = "1.0.194" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6acc6b5822b9526adfb4fc377b67128fdd60aac757cc4a741a6278603f763cf" -dependencies = [ - "indexmap 2.13.0", - "proc-macro2", - "quote", - "syn 2.0.117", -] - [[package]] name = "doxygen-bindgen" version = "0.1.3" @@ -376,19 +124,6 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" -[[package]] -name = "env_logger" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - [[package]] name = "equivalent" version = "1.0.2" @@ -423,12 +158,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" -[[package]] -name = "foldhash" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" - [[package]] name = "futures-core" version = "0.3.32" @@ -483,19 +212,13 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - [[package]] name = "hashbrown" version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" dependencies = [ - "foldhash 0.1.5", + "foldhash", ] [[package]] @@ -510,38 +233,12 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "humantime" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "135b12329e5e3ce057a9f972339ea52bc954fe1e9358ef27f95e89716fbc5424" - [[package]] name = "id-arena" version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", - "serde", -] - [[package]] name = "indexmap" version = "2.13.0" @@ -554,30 +251,6 @@ dependencies = [ "serde_core", ] -[[package]] -name = "indoc" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa799dd5ed20a7e349f3b4639aa80d74549c81716d9ec4f994c9b5815598306" - -[[package]] -name = "itertools" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" -dependencies = [ - "either", -] - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.13.0" @@ -624,15 +297,6 @@ dependencies = [ "windows-link", ] -[[package]] -name = "link-cplusplus" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f78c730aaa7d0b9336a299029ea49f9ee53b0ed06e9202e8cb7db9bae7b8c82" -dependencies = [ - "cc", -] - [[package]] name = "linux-raw-sys" version = "0.12.1" @@ -660,44 +324,12 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" -[[package]] -name = "miette" -version = "5.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59bb584eaeeab6bd0226ccf3509a69d7936d148cf3d036ad350abe35e8c6856e" -dependencies = [ - "miette-derive", - "once_cell", - "thiserror", - "unicode-width 0.1.14", -] - -[[package]] -name = "miette-derive" -version = "5.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.117", -] - [[package]] name = "minimal-lexical" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" -[[package]] -name = "moveit" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87d7335204cb6ef7bd647fa6db0be3e4d7aa25b5823a7aa030027ddf512cefba" -dependencies = [ - "cxx", -] - [[package]] name = "nixide" version = "0.1.0" @@ -714,11 +346,10 @@ dependencies = [ name = "nixide-sys" version = "0.1.0" dependencies = [ - "autocxx", - "autocxx-build", "bindgen", "cc", "doxygen-bindgen", + "heck", "itertools 0.14.0", "pkg-config", "serial_test", @@ -782,31 +413,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn 2.0.117", -] - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", + "syn", ] [[package]] @@ -851,7 +458,7 @@ dependencies = [ "aho-corasick", "memchr", "regex-automata", - "regex-syntax 0.8.10", + "regex-syntax", ] [[package]] @@ -862,55 +469,15 @@ checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.10", + "regex-syntax", ] -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - [[package]] name = "regex-syntax" version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" -[[package]] -name = "regex_static" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6126d61c5e4b41929098f73b42fc1d257116cc95d19739248c51591f77cc0021" -dependencies = [ - "once_cell", - "regex", - "regex_static_macro", -] - -[[package]] -name = "regex_static_impl" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3755019886a70e772e6360b0b58501d75cf7dc17a53e08aa97e59ecb2c2bc5" -dependencies = [ - "proc-macro2", - "quote", - "regex-syntax 0.6.29", - "syn 1.0.109", -] - -[[package]] -name = "regex_static_macro" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79b15495fd034158635bc8b762a132dfc83864d6992aeda1ffabf01b03b611a1" -dependencies = [ - "proc-macro2", - "regex_static_impl", - "syn 1.0.109", -] - [[package]] name = "rustc-hash" version = "2.1.1" @@ -930,12 +497,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "rustversion" -version = "1.0.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" - [[package]] name = "scc" version = "2.4.0" @@ -951,12 +512,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "scratch" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d68f2ec51b097e4c1a75b681a8bec621909b5e91f15bb7b840c4f2f7b01148b2" - [[package]] name = "sdd" version = "3.0.10" @@ -976,7 +531,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" dependencies = [ "serde_core", - "serde_derive", ] [[package]] @@ -996,7 +550,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn", ] [[package]] @@ -1035,7 +589,7 @@ checksum = "0a7d91949b85b0d2fb687445e448b40d322b6b3e4af6b44a29b21d9a5f33e6d9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn", ] [[package]] @@ -1062,23 +616,6 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4af28eeb7c18ac2dbdb255d40bee63f203120e1db6b0024b177746ebec7049c1" -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - [[package]] name = "syn" version = "2.0.117" @@ -1103,65 +640,18 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "thiserror" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.117", -] - [[package]] name = "unicode-ident" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" -[[package]] -name = "unicode-width" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" - -[[package]] -name = "unicode-width" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" - [[package]] name = "unicode-xid" version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - [[package]] name = "wasip2" version = "1.0.2+wasi-0.2.9" @@ -1197,7 +687,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" dependencies = [ "anyhow", - "indexmap 2.13.0", + "indexmap", "wasm-encoder", "wasmparser", ] @@ -1210,41 +700,10 @@ checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" dependencies = [ "bitflags", "hashbrown 0.15.5", - "indexmap 2.13.0", + "indexmap", "semver", ] -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" -dependencies = [ - "windows-sys", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - [[package]] name = "windows-link" version = "0.2.1" @@ -1288,9 +747,9 @@ checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" dependencies = [ "anyhow", "heck", - "indexmap 2.13.0", + "indexmap", "prettyplease", - "syn 2.0.117", + "syn", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -1306,7 +765,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn 2.0.117", + "syn", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -1319,7 +778,7 @@ checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" dependencies = [ "anyhow", "bitflags", - "indexmap 2.13.0", + "indexmap", "log", "serde", "serde_derive", @@ -1338,7 +797,7 @@ checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" dependencies = [ "anyhow", "id-arena", - "indexmap 2.13.0", + "indexmap", "log", "semver", "serde", diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..5473e64 --- /dev/null +++ b/TODO.md @@ -0,0 +1,3 @@ +- [ ] rename all `::std::os::raw` instances to ``::core::ffi` + +- [ ] I probably don't need my implementations of `NixError` and `NixVerbosity` now, I could just re-export them for sys diff --git a/nixide-sys/Cargo.toml b/nixide-sys/Cargo.toml index 5f7a70b..41a1b93 100644 --- a/nixide-sys/Cargo.toml +++ b/nixide-sys/Cargo.toml @@ -14,7 +14,7 @@ build = "build.rs" targets = [ "x86_64-unknown-linux-gnu" ] [lib] -path = "lib.rs" +path = "src/lib.rs" # NOTE: `[features]` have a 1-1 correspondence to the # NOTE: shared libraries produced by the Nix C API. @@ -28,15 +28,14 @@ nix-flake-c = [] nix-main-c = [] [build-dependencies] +itertools = "0.14.0" +heck = "0.5.0" + +# rust-bindgen bindgen = { default-features = false, features = [ "logging", "runtime" ], version = "0.72.1" } doxygen-bindgen = "0.1.3" -itertools = "0.14.0" pkg-config.workspace = true cc.workspace = true -autocxx-build = "0.30.0" [dev-dependencies] serial_test = "3.4.0" - -[dependencies] -autocxx = "0.30.0" diff --git a/nixide-sys/build.rs b/nixide-sys/build.rs index ede5d4f..79d68ad 100644 --- a/nixide-sys/build.rs +++ b/nixide-sys/build.rs @@ -1,7 +1,11 @@ +use std::env; +use std::fs; use std::path::PathBuf; -use std::{env, fs}; -use bindgen::callbacks::ParseCallbacks; +use bindgen::RustEdition; +use bindgen::callbacks::{ItemKind, ParseCallbacks}; +use heck::ToSnekCase; +use heck::ToUpperCamelCase; use itertools::Itertools; #[derive(Debug)] @@ -19,7 +23,57 @@ impl ParseCallbacks for DoxygenCallbacks { } } -// WARNING: NOTE: the random panic occurs when you're missing imports!! +/// Bindfmt is just the name im giving to the callbacks +/// that handle renaming C/C++ tokens. +#[derive(Debug)] +struct BindfmtCallbacks; + +#[inline] +fn strip_variant_prefix( + prefix: &'static str, + enum_name: &str, + variant: &str, +) -> Result { + variant + .strip_prefix(prefix) + .map(str::to_owned) + .ok_or(format!( + "[bindfmt] enum {enum_name} expected prefix \"{prefix}\" but got {}", + &variant + )) +} + +impl ParseCallbacks for BindfmtCallbacks { + fn enum_variant_name( + &self, + _enum_name: Option<&str>, + _original_variant_name: &str, + _variant_value: bindgen::callbacks::EnumVariantValue, + ) -> Option { + let variant = _original_variant_name.to_upper_camel_case(); + + _enum_name.map(|enum_name| match enum_name.to_upper_camel_case().as_ref() { + "NixVerbosity" => strip_variant_prefix("NixLvl", enum_name, &variant).unwrap(), + "NixErr" => strip_variant_prefix("NixErr", enum_name, &variant) + .or_else(|_| strip_variant_prefix("Nix", enum_name, &variant)) + .unwrap(), + "ValueType" => strip_variant_prefix("NixType", enum_name, &variant).unwrap(), + _ => variant, + }) + } + + fn item_name(&self, _item_info: bindgen::callbacks::ItemInfo) -> Option { + Some(match _item_info.kind { + ItemKind::Type => _item_info.name.to_upper_camel_case(), + _ => _item_info.name.to_snek_case(), + }) + } + + fn include_file(&self, _filename: &str) { + eprintln!("[debug] including file: {}", _filename); + } +} + const LIBS: &[&'static str] = &[ #[cfg(feature = "nix-util-c")] "nix-util-c", @@ -36,42 +90,61 @@ const LIBS: &[&'static str] = &[ ]; fn main() { - // Invalidate the built crate if the binding headers change - // println!("cargo::rerun-if-changed=include"); + let include_paths: Vec = LIBS + .iter() + .map(|&name| { + let lib = pkg_config::probe_library(name) + .expect(&format!("Unable to find .pc file for {}", name)); - let lib_args: Vec = vec![ /* EXTRA ARGS */ ] - .into_iter() - .map(|s: &str| s.to_owned()) - .chain( - LIBS.iter() - .map(|&name| { - let lib = pkg_config::probe_library(name) - .expect(&format!("Unable to find .pc file for {}", name)); + for p in lib.link_files { + println!("cargo::rustc-link-lib={}", p.display()); + } - for p in lib.link_files { - println!("cargo::rustc-link-lib={}", p.display()); - } - - lib.include_paths - .into_iter() - .map(|p| format!("-I{}", p.display())) - }) - .flatten(), - ) + lib.include_paths + }) + .flatten() .unique() .collect(); - dbg!(&lib_args); + let clang_args: Vec = vec!["-x", "c++", "-std=c++23"] + .into_iter() + .map(|s: &str| s.to_owned()) + .chain(include_paths.iter().map(|p| format!("-I{}", p.display()))) + .collect(); + + dbg!(&clang_args); let mut builder = bindgen::Builder::default() - // .enable_cxx_namespaces() - .clang_args(lib_args) - .parse_callbacks(Box::new(bindgen::CargoCallbacks::new())) + .rust_edition(RustEdition::Edition2024) + .clang_args(clang_args) // Add `doxygen_bindgen` callbacks .parse_callbacks(Box::new(DoxygenCallbacks)) + .parse_callbacks(Box::new(BindfmtCallbacks)) + .parse_callbacks(Box::new(bindgen::CargoCallbacks::new())) // Format generated bindings with rustfmt .formatter(bindgen::Formatter::Rustfmt) - .rustfmt_configuration_file(std::fs::canonicalize("rustfmt.toml").ok()); + .rustfmt_configuration_file(std::fs::canonicalize("rustfmt.toml").ok()) + .allowlist_file(r".*nix_api_[a-z]+\.h") + // Wrap all unsafe operations in unsafe blocks + .layout_tests(true) + .use_core() // use ::core instead of ::std + .ctypes_prefix("::core::ffi") // use ::core::ffi instead of ::std::os::raw + .time_phases(true) + .wrap_unsafe_ops(true) + .trust_clang_mangling(true) + .respect_cxx_access_specs(true) + .default_enum_style(bindgen::EnumVariation::Rust { non_exhaustive: false }) + .translate_enum_integer_types(false) + .size_t_is_usize(true) + .use_distinct_char16_t(false) + .generate_comments(false) + .generate_cstr(true) // use &CStr instead of &[u8] + .fit_macro_constants(true) + .explicit_padding(true) + .enable_cxx_namespaces() + .represent_cxx_operators(true) + .enable_function_attribute_detection() + .raw_line("/** These bindings were auto-generated for the Nixide project (https://github.com/cry128/nixide) */"); // Register the input headers we would like to generate bindings for builder = LIBS @@ -80,7 +153,7 @@ fn main() { let path = format!("include/{}.h", lib.strip_suffix("-c").unwrap()); assert!(fs::exists(&path).unwrap()); // Invalidate the built crate if the binding headers change - // println!("cargo::rerun-if-changed={path}"); + println!("cargo::rerun-if-changed={path}"); path }) .fold(builder, |builder, path| builder.header(path)); diff --git a/nixide-sys/lib.rs b/nixide-sys/lib.rs deleted file mode 100644 index 4c744cd..0000000 --- a/nixide-sys/lib.rs +++ /dev/null @@ -1,17 +0,0 @@ -//! # nixide-sys -//! -//! Unsafe direct FFI bindings to libnix C API. -//! -//! ## Safety -//! -//! These bindings are generated automatically and map directly to the C API. -//! They are unsafe to use directly. Prefer using the high-level safe API in the -//! parent crate unless you know what you're doing. - -#![allow(non_upper_case_globals)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(rustdoc::bare_urls)] -#![allow(rustdoc::invalid_html_tags)] - -include!(concat!(env!("OUT_DIR"), "/bindings.rs")); diff --git a/nixide-sys/src/lib.rs b/nixide-sys/src/lib.rs new file mode 100644 index 0000000..9e938e1 --- /dev/null +++ b/nixide-sys/src/lib.rs @@ -0,0 +1,23 @@ +//! # nixide-sys +//! +//! Unsafe direct FFI bindings to `libnix` C API. +//! +//! ## Safety +//! +//! These bindings are generated automatically and map directly to the C API. +//! They are unsafe to use directly. Prefer using the high-level safe API in the +//! parent crate unless you know what you're doing. +//! +//! The [nixide] crate should also act as good explanation of how +//! these bindings, and hence `libnix` itself, are expected to be used. + +mod bindings { + #![allow(non_upper_case_globals)] + #![allow(non_camel_case_types)] + #![allow(non_snake_case)] + #![allow(rustdoc::bare_urls)] + #![allow(rustdoc::invalid_html_tags)] + + include!(concat!(env!("OUT_DIR"), "/bindings.rs")); +} +pub use bindings::root::*; diff --git a/nixide-sys/tests/README.md b/nixide-sys/tests/README.md new file mode 100644 index 0000000..c884d40 --- /dev/null +++ b/nixide-sys/tests/README.md @@ -0,0 +1,2 @@ +# `nixide-sys/tests` +These tests are modified from the ones provided by [github:nixops4/nix-bindings-rust](https://github.com/nixops4/nix-bindings-rust)