From 5acac6b1f2e701095ae9cf952be11c15960a5792 Mon Sep 17 00:00:00 2001 From: Charles Schleich Date: Tue, 1 Oct 2024 17:14:53 +0200 Subject: [PATCH] Use new Serialization and zenoh-ext API (#279) --- Cargo.lock | 250 +++++++++--------- Cargo.toml | 7 +- .../src/discovered_entities.rs | 6 +- zenoh-plugin-ros2dds/src/lib.rs | 8 +- zenoh-plugin-ros2dds/src/ros2_utils.rs | 52 ++-- zenoh-plugin-ros2dds/src/route_service_cli.rs | 5 +- zenoh-plugin-ros2dds/src/route_service_srv.rs | 6 +- zenoh-plugin-ros2dds/src/route_subscriber.rs | 2 +- zenoh-plugin-ros2dds/src/routes_mgr.rs | 6 +- 9 files changed, 180 insertions(+), 162 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b4d1858..cde49c0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -223,7 +223,7 @@ checksum = "965c2d33e53cb6b267e148a4cb0760bc01f4904c1cd4bb4002a085bb016d1490" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", "synstructure", ] @@ -235,7 +235,7 @@ checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -489,13 +489,13 @@ checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" [[package]] name = "async-trait" -version = "0.1.82" +version = "0.1.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -506,9 +506,9 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "backtrace" @@ -589,7 +589,7 @@ dependencies = [ "regex", "rustc-hash 1.1.0", "shlex", - "syn 2.0.77", + "syn 2.0.79", "which", ] @@ -689,9 +689,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.7.1" +version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" +checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" [[package]] name = "cache-padded" @@ -701,9 +701,9 @@ checksum = "981520c98f422fcc584dc1a95c334e6953900b9106bc47a9839b81790009eb21" [[package]] name = "cc" -version = "1.1.20" +version = "1.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45bcde016d64c21da4be18b655631e5ab6d3107607e71a73a9f53eb48aae23fb" +checksum = "3bbb537bb4a30b90362caddba8f360c0a56bc13d3a5570028e7197204cb54a17" dependencies = [ "shlex", ] @@ -798,9 +798,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.17" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e5a21b8495e732f1b3c364c9949b201ca7bae518c502c80256c96ad79eaf6ac" +checksum = "b0956a43b323ac1afaffc053ed5c4b7c1f1800bacd1683c353aabbb752515dd3" dependencies = [ "clap_builder", "clap_derive", @@ -808,9 +808,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.17" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cf2dd12af7a047ad9d6da2b6b249759a22a7abc0f474c1dae1777afa4b21a73" +checksum = "4d72166dd41634086d5803a47eb71ae740e61d84709c36f3c34110173db3961b" dependencies = [ "anstream", "anstyle", @@ -820,14 +820,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.13" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1124,7 +1124,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1199,8 +1199,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "531e46835a22af56d1e3b66f04844bed63158bc094a628bec1d321d9b4c44bf2" dependencies = [ "bit-set", - "regex-automata 0.4.7", - "regex-syntax 0.8.4", + "regex-automata 0.4.8", + "regex-syntax 0.8.5", ] [[package]] @@ -1361,7 +1361,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1461,7 +1461,7 @@ checksum = "53010ccb100b96a67bc32c0175f0ed1426b31b655d562898e57325f81c023ac0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1617,9 +1617,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.9.4" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" [[package]] name = "humantime" @@ -1629,9 +1629,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "iana-time-zone" -version = "0.1.60" +version = "0.1.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1860,11 +1860,17 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" +[[package]] +name = "leb128" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" + [[package]] name = "libc" -version = "0.2.158" +version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "libloading" @@ -2155,9 +2161,12 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1" +dependencies = [ + "portable-atomic", +] [[package]] name = "opaque-debug" @@ -2247,9 +2256,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.12" +version = "2.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c73c26c01b8c87956cea613c907c9d6ecffd8d18a2a5908e5de0adfaa185cea" +checksum = "fdbef9d1d47087a895abd220ed25eb4ad973a5e26f6a4367b038c25e28dfc2d9" dependencies = [ "memchr", "thiserror", @@ -2258,9 +2267,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.12" +version = "2.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "664d22978e2815783adbdd2c588b455b1bd625299ce36b2a99881ac9627e6d8d" +checksum = "4d3a6e3394ec80feb3b6393c725571754c6188490265c61aaf260810d6b95aa0" dependencies = [ "pest", "pest_generator", @@ -2268,22 +2277,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.12" +version = "2.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2d5487022d5d33f4c30d91c22afa240ce2a644e87fe08caad974d4eab6badbe" +checksum = "94429506bde1ca69d1b5601962c73f4172ab4726571a59ea95931218cb0e930e" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] name = "pest_meta" -version = "2.7.12" +version = "2.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0091754bbd0ea592c4deb3a122ce8ecbb0753b738aa82bc055fcc2eccc8d8174" +checksum = "ac8a071862e93690b6e34e9a5fb8e33ff3734473ac0245b27232222c4906a33f" dependencies = [ "once_cell", "pest", @@ -2330,7 +2339,7 @@ dependencies = [ "phf_shared", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -2359,7 +2368,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -2486,6 +2495,12 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "portable-atomic" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" + [[package]] name = "powerfmt" version = "0.2.0" @@ -2508,7 +2523,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479cf940fbbb3426c32c5d5176f62ad57549a0bb84773423ba8be9d089f5faba" dependencies = [ "proc-macro2", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -2657,9 +2672,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.4" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0884ad60e090bf1345b93da0a5de8923c93884cd03f40dfcfddd3b4bee661853" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ "bitflags 2.6.0", ] @@ -2677,14 +2692,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.6" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.7", - "regex-syntax 0.8.4", + "regex-automata 0.4.8", + "regex-syntax 0.8.5", ] [[package]] @@ -2698,13 +2713,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.4", + "regex-syntax 0.8.5", ] [[package]] @@ -2715,9 +2730,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "ring" @@ -2884,19 +2899,18 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "2.1.3" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" dependencies = [ - "base64 0.22.1", "rustls-pki-types", ] [[package]] name = "rustls-pki-types" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" +checksum = "0e696e35370c65c9c541198af4543ccd580cf17fc25d8e05c5a242b202488c55" [[package]] name = "rustls-platform-verifier" @@ -2982,7 +2996,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -3017,9 +3031,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.11.1" +version = "2.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" +checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6" dependencies = [ "core-foundation-sys", "libc", @@ -3086,7 +3100,7 @@ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -3097,7 +3111,7 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -3487,9 +3501,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.77" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", @@ -3504,27 +3518,27 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -3677,7 +3691,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -3738,7 +3752,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -3835,9 +3849,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "ucd-trie" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" [[package]] name = "uhlc" @@ -3867,18 +3881,18 @@ checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-normalization" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" dependencies = [ "tinyvec", ] [[package]] name = "unicode-xid" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" [[package]] name = "universal-hash" @@ -3902,12 +3916,6 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" -[[package]] -name = "unwrap-infallible" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" - [[package]] name = "unzip-n" version = "0.1.2" @@ -4099,7 +4107,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", "wasm-bindgen-shared", ] @@ -4133,7 +4141,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4156,9 +4164,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.26.5" +version = "0.26.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bd24728e5af82c6c4ec1b66ac4844bdf8156257fccda846ec58b42cd0cdbe6a" +checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" dependencies = [ "rustls-pki-types", ] @@ -4383,7 +4391,7 @@ dependencies = [ [[package]] name = "zenoh" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "ahash", "async-trait", @@ -4410,7 +4418,6 @@ dependencies = [ "tokio-util", "tracing", "uhlc", - "unwrap-infallible", "vec_map", "zenoh-buffers", "zenoh-codec", @@ -4452,7 +4459,7 @@ dependencies = [ [[package]] name = "zenoh-buffers" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "zenoh-collections", ] @@ -4460,7 +4467,7 @@ dependencies = [ [[package]] name = "zenoh-codec" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "tracing", "uhlc", @@ -4471,12 +4478,12 @@ dependencies = [ [[package]] name = "zenoh-collections" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" [[package]] name = "zenoh-config" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "json5", "num_cpus", @@ -4497,7 +4504,7 @@ dependencies = [ [[package]] name = "zenoh-core" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "lazy_static", "tokio", @@ -4508,7 +4515,7 @@ dependencies = [ [[package]] name = "zenoh-crypto" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "aes 0.8.4", "hmac 0.12.1", @@ -4521,11 +4528,12 @@ dependencies = [ [[package]] name = "zenoh-ext" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "bincode", "flume", "futures", + "leb128", "serde", "tokio", "tracing", @@ -4537,7 +4545,7 @@ dependencies = [ [[package]] name = "zenoh-keyexpr" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "hashbrown", "keyed-set", @@ -4551,7 +4559,7 @@ dependencies = [ [[package]] name = "zenoh-link" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "zenoh-config", "zenoh-link-commons", @@ -4568,7 +4576,7 @@ dependencies = [ [[package]] name = "zenoh-link-commons" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "async-trait", "flume", @@ -4591,7 +4599,7 @@ dependencies = [ [[package]] name = "zenoh-link-quic" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "async-trait", "base64 0.22.1", @@ -4616,7 +4624,7 @@ dependencies = [ [[package]] name = "zenoh-link-tcp" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "async-trait", "socket2 0.5.7", @@ -4633,7 +4641,7 @@ dependencies = [ [[package]] name = "zenoh-link-tls" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "async-trait", "base64 0.22.1", @@ -4660,7 +4668,7 @@ dependencies = [ [[package]] name = "zenoh-link-udp" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "async-trait", "socket2 0.5.7", @@ -4679,7 +4687,7 @@ dependencies = [ [[package]] name = "zenoh-link-unixsock_stream" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "async-trait", "nix", @@ -4697,7 +4705,7 @@ dependencies = [ [[package]] name = "zenoh-link-ws" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "async-trait", "futures-util", @@ -4717,18 +4725,18 @@ dependencies = [ [[package]] name = "zenoh-macros" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", "zenoh-keyexpr", ] [[package]] name = "zenoh-plugin-rest" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "anyhow", "async-std", @@ -4778,7 +4786,7 @@ dependencies = [ [[package]] name = "zenoh-plugin-trait" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "git-version", "libloading", @@ -4794,7 +4802,7 @@ dependencies = [ [[package]] name = "zenoh-protocol" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "const_format", "rand 0.8.5", @@ -4808,7 +4816,7 @@ dependencies = [ [[package]] name = "zenoh-result" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "anyhow", ] @@ -4816,7 +4824,7 @@ dependencies = [ [[package]] name = "zenoh-runtime" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "lazy_static", "ron", @@ -4829,7 +4837,7 @@ dependencies = [ [[package]] name = "zenoh-sync" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "event-listener 5.3.1", "futures", @@ -4842,7 +4850,7 @@ dependencies = [ [[package]] name = "zenoh-task" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "futures", "tokio", @@ -4855,7 +4863,7 @@ dependencies = [ [[package]] name = "zenoh-transport" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "async-trait", "crossbeam-utils", @@ -4888,7 +4896,7 @@ dependencies = [ [[package]] name = "zenoh-util" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "async-trait", "const_format", @@ -4928,7 +4936,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 7efff61..e8ca700 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,19 +43,18 @@ serde_json = "1.0.114" tokio = { version = "1.35.1", default-features = false } # Default features are disabled due to some crates' requirements tracing = "0.1" zenoh = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = [ - "internal", - "internal_config", - "unstable", "plugins", + "unstable", ] } zenoh-config = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", default-features = false } zenoh-ext = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = [ "unstable", ] } -zenoh-plugin-rest = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", default-features = false, features=["static_plugin"]} zenoh-plugin-ros2dds = { version = "1.0.0-dev", path = "zenoh-plugin-ros2dds/", default-features = false } +zenoh-plugin-rest = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", default-features = false, features=["static_plugin"]} zenoh-plugin-trait = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", default-features = false } + [profile.release] codegen-units = 1 debug = false diff --git a/zenoh-plugin-ros2dds/src/discovered_entities.rs b/zenoh-plugin-ros2dds/src/discovered_entities.rs index 82efb0e..0c03c81 100644 --- a/zenoh-plugin-ros2dds/src/discovered_entities.rs +++ b/zenoh-plugin-ros2dds/src/discovered_entities.rs @@ -453,10 +453,10 @@ impl DiscoveredEntities { match self.get_entity_json_value(entity_ref) { Ok(Some(v)) => { let admin_keyexpr = admin_keyexpr_prefix / key_expr; - match ZBytes::try_from(v) { - Ok(payload) => { + match serde_json::to_vec(&v) { + Ok(bytes) => { if let Err(e) = query - .reply(admin_keyexpr, payload) + .reply(admin_keyexpr, ZBytes::from(bytes)) .encoding(Encoding::APPLICATION_JSON) .await { diff --git a/zenoh-plugin-ros2dds/src/lib.rs b/zenoh-plugin-ros2dds/src/lib.rs index 1d6d59c..ebba5d8 100644 --- a/zenoh-plugin-ros2dds/src/lib.rs +++ b/zenoh-plugin-ros2dds/src/lib.rs @@ -601,8 +601,8 @@ impl ROS2PluginRuntime { async fn send_admin_reply(&self, query: &Query, key_expr: &keyexpr, admin_ref: &AdminRef) { let z_bytes: ZBytes = match admin_ref { AdminRef::Version => match serde_json::to_value(ROS2Plugin::PLUGIN_LONG_VERSION) { - Ok(v) => match ZBytes::try_from(v) { - Ok(value) => value, + Ok(v) => match serde_json::to_vec(&v) { + Ok(bytes) => ZBytes::from(bytes), Err(e) => { tracing::warn!("Error transforming JSON to ZBytes: {}", e); return; @@ -614,8 +614,8 @@ impl ROS2PluginRuntime { } }, AdminRef::Config => match serde_json::to_value(&*self.config) { - Ok(v) => match ZBytes::try_from(v) { - Ok(value) => value, + Ok(v) => match serde_json::to_vec(&v) { + Ok(bytes) => ZBytes::from(bytes), Err(e) => { tracing::warn!("Error transforming JSON to ZBytes: {}", e); return; diff --git a/zenoh-plugin-ros2dds/src/ros2_utils.rs b/zenoh-plugin-ros2dds/src/ros2_utils.rs index 3a1b16f..6995f51 100644 --- a/zenoh-plugin-ros2dds/src/ros2_utils.rs +++ b/zenoh-plugin-ros2dds/src/ros2_utils.rs @@ -13,7 +13,6 @@ // use std::{ - collections::HashMap, env::VarError, sync::atomic::{AtomicU32, Ordering}, }; @@ -220,15 +219,15 @@ impl CddsRequestHeader { } pub fn as_attachment(&self) -> ZBytes { - let mut hashmap = HashMap::new(); - // concat header + endianness flag let mut buf = [0u8; 17]; buf[0..16].copy_from_slice(&self.header); buf[16] = self.is_little_endian as u8; - hashmap.insert(ATTACHMENT_KEY_REQUEST_HEADER, buf); - ZBytes::from_iter(hashmap.iter()) + let mut writer = ZBytes::writer(); + writer.append(ZBytes::from(ATTACHMENT_KEY_REQUEST_HEADER)); + writer.append(ZBytes::from(buf)); + writer.finish() } } @@ -236,23 +235,34 @@ impl TryFrom<&ZBytes> for CddsRequestHeader { type Error = ZError; fn try_from(value: &ZBytes) -> Result { - let hashmap: HashMap<[u8; 3], [u8; 17]> = - HashMap::from_iter(value.iter::<([u8; 3], [u8; 17])>().map(Result::unwrap)); - match hashmap.get(&ATTACHMENT_KEY_REQUEST_HEADER) { - Some(buf) => { - if buf.len() == 17 { - let header: [u8; 16] = buf[0..16] - .try_into() - .expect("Shouldn't happen: buf is 17 bytes"); - Ok(CddsRequestHeader { - header, - is_little_endian: buf[16] != 0, - }) - } else { - bail!("Attachment 'header' is not 16 bytes: {buf:02x?}") - } + let bytes = value.to_bytes(); + + let header = match bytes.get(0..ATTACHMENT_KEY_REQUEST_HEADER.len()) { + Some(header) => header, + None => bail!("No 'key request header' bytes found in attachment"), + }; + + if header != ATTACHMENT_KEY_REQUEST_HEADER { + bail!( + "Initial {:?} bytes do not match ATTACHMENT_KEY_REQUEST_HEADER", + ATTACHMENT_KEY_REQUEST_HEADER.len() + ) + } + + if let Some(buf) = bytes.get(ATTACHMENT_KEY_REQUEST_HEADER.len()..) { + if buf.len() == 17 { + let header: [u8; 16] = buf[0..16] + .try_into() + .expect("Shouldn't happen: buf is 17 bytes"); + Ok(CddsRequestHeader { + header, + is_little_endian: buf[16] != 0, + }) + } else { + bail!("Attachment 'header' is not 16 bytes: {buf:02x?}") } - None => bail!("No 'header' key found in Attachment"), + } else { + bail!("Could not Read Remaining Attachment Buffer") } } } diff --git a/zenoh-plugin-ros2dds/src/route_service_cli.rs b/zenoh-plugin-ros2dds/src/route_service_cli.rs index 1f32d1b..525d1d0 100644 --- a/zenoh-plugin-ros2dds/src/route_service_cli.rs +++ b/zenoh-plugin-ros2dds/src/route_service_cli.rs @@ -355,7 +355,7 @@ fn route_dds_request_to_zenoh( // https://github.com/ros2/rmw_cyclonedds/blob/2263814fab142ac19dd3395971fb1f358d22a653/rmw_cyclonedds_cpp/src/serdata.hpp#L73 let z_bytes: ZBytes = sample.into(); - let slice: ZSlice = z_bytes.into(); + let slice: ZSlice = ZBuf::from(z_bytes).to_zslice(); // Decompose the slice into 3 sub-slices (4 bytes header, 16 bytes request_id and payload) let (payload, request_id, header) = match ( @@ -376,6 +376,7 @@ fn route_dds_request_to_zenoh( // route request buffer stripped from request_id let mut zenoh_req_buf = ZBuf::empty(); + zenoh_req_buf.push_zslice(header); zenoh_req_buf.push_zslice(payload); @@ -431,7 +432,7 @@ fn route_zenoh_reply_to_dds( ) { match reply.result() { Ok(sample) => { - let zenoh_rep_buf = sample.payload().into::>(); + let zenoh_rep_buf = sample.payload().to_bytes(); if zenoh_rep_buf.len() < 4 || zenoh_rep_buf[1] > 1 { tracing::warn!( "{route_id}: received invalid reply from Zenoh for {request_id}: {zenoh_rep_buf:0x?}" diff --git a/zenoh-plugin-ros2dds/src/route_service_srv.rs b/zenoh-plugin-ros2dds/src/route_service_srv.rs index a468f6e..597e053 100644 --- a/zenoh-plugin-ros2dds/src/route_service_srv.rs +++ b/zenoh-plugin-ros2dds/src/route_service_srv.rs @@ -361,7 +361,7 @@ fn route_zenoh_request_to_dds( // if any and if long enoough it shall be the Request type encoded as CDR (including 4 bytes header) let is_little_endian = match query.payload() { Some(value) if value.len() > 4 => { - is_cdr_little_endian(value.into::().as_ref()).unwrap_or(true) + is_cdr_little_endian(value.to_bytes().as_ref()).unwrap_or(true) } _ => true, }; @@ -383,7 +383,7 @@ fn route_zenoh_request_to_dds( // https://github.com/ros2/rmw_cyclonedds/blob/2263814fab142ac19dd3395971fb1f358d22a653/rmw_cyclonedds_cpp/src/serdata.hpp#L73 let dds_req_buf = if let Some(value) = query.payload() { // The query comes with some payload. It's expected to be the Request type encoded as CDR (including 4 bytes header) - let zenoh_req_buf = value.into::>(); + let zenoh_req_buf = value.to_bytes(); if zenoh_req_buf.len() < 4 || zenoh_req_buf[1] > 1 { tracing::warn!("{route_id}: received invalid request: {zenoh_req_buf:0x?}"); return; @@ -442,7 +442,7 @@ fn route_dds_reply_to_zenoh( // https://github.com/ros2/rmw_cyclonedds/blob/2263814fab142ac19dd3395971fb1f358d22a653/rmw_cyclonedds_cpp/src/serdata.hpp#L73 let z_bytes: ZBytes = sample.into(); - let slice: ZSlice = z_bytes.into(); + let slice: ZSlice = ZBuf::from(z_bytes).to_zslice(); // Decompose the slice into 3 sub-slices (4 bytes header, 16 bytes request_id and payload) let (payload, request_id, header) = match ( diff --git a/zenoh-plugin-ros2dds/src/route_subscriber.rs b/zenoh-plugin-ros2dds/src/route_subscriber.rs index 26454b6..92492ad 100644 --- a/zenoh-plugin-ros2dds/src/route_subscriber.rs +++ b/zenoh-plugin-ros2dds/src/route_subscriber.rs @@ -357,7 +357,7 @@ fn route_zenoh_message_to_dds(s: Sample, ros2_name: &str, data_writer: dds_entit } unsafe { - let bs = s.payload().into(); + let bs = s.payload().to_bytes().to_vec(); // As per the Vec documentation (see https://doc.rust-lang.org/std/vec/struct.Vec.html#method.into_raw_parts) // the only way to correctly releasing it is to create a vec using from_raw_parts // and then have its destructor do the cleanup. diff --git a/zenoh-plugin-ros2dds/src/routes_mgr.rs b/zenoh-plugin-ros2dds/src/routes_mgr.rs index 17ae610..620a827 100644 --- a/zenoh-plugin-ros2dds/src/routes_mgr.rs +++ b/zenoh-plugin-ros2dds/src/routes_mgr.rs @@ -792,10 +792,10 @@ impl<'a> RoutesMgr { match self.get_entity_json_value(route_ref) { Ok(Some(v)) => { let admin_keyexpr = &self.admin_prefix / key_expr; - match ZBytes::try_from(v) { - Ok(payload) => { + match serde_json::to_vec(&v) { + Ok(bytes) => { if let Err(e) = query - .reply(admin_keyexpr, payload) + .reply(admin_keyexpr, ZBytes::from(bytes)) .encoding(Encoding::APPLICATION_JSON) .await {