From 1b1dec2bee83841ca8f3f7670c936fca1fa8ca82 Mon Sep 17 00:00:00 2001 From: Troels Dalsgaard Hoffmeyer Date: Tue, 5 Nov 2024 23:36:13 +0100 Subject: [PATCH] zbus: Update to 5.1 --- Cargo.lock | 284 ++++++++++++---------------------- Cargo.toml | 8 +- src/bin/dtui/app.rs | 1 - src/bin/dtui/main.rs | 6 +- src/bin/dtui/parser.rs | 76 +++++---- src/bin/dtui/stateful_tree.rs | 26 +++- src/bin/dtui/ui.rs | 4 +- 7 files changed, 163 insertions(+), 242 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 77ecc58..5ad6a42 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -117,6 +117,30 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "async-executor" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30ca9a001c1e8ba5149f91a74362376cc6bc5b919d92d988668657bd570bdcec" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "slab", +] + +[[package]] +name = "async-fs" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebcd09b382f40fcd159c2d695175b2ae620ffa5f3bd6f664131efff4e8b9e04a" +dependencies = [ + "async-lock", + "blocking", + "futures-lite", +] + [[package]] name = "async-io" version = "2.3.4" @@ -149,9 +173,9 @@ dependencies = [ [[package]] name = "async-process" -version = "2.2.4" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a07789659a4d385b79b18b9127fc27e1a59e1e89117c78c5ea3b806f016374" +checksum = "63255f1dc2381611000436537bbedfe83183faa303a5a0edaf191edef06526bb" dependencies = [ "async-channel", "async-io", @@ -164,7 +188,6 @@ dependencies = [ "futures-lite", "rustix", "tracing", - "windows-sys 0.59.0", ] [[package]] @@ -204,9 +227,9 @@ 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", @@ -246,15 +269,6 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - [[package]] name = "blocking" version = "1.6.1" @@ -268,12 +282,6 @@ dependencies = [ "piper", ] -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - [[package]] name = "bytes" version = "1.7.1" @@ -322,7 +330,7 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8eebd66744a15ded14960ab4ccdbfb51ad3b81f51f3f04a80adac98c985396c9" dependencies = [ - "hashbrown", + "hashbrown 0.14.5", "stacker", ] @@ -394,15 +402,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "cpufeatures" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" -dependencies = [ - "libc", -] - [[package]] name = "crossbeam-utils" version = "0.8.20" @@ -434,26 +433,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", -] - [[package]] name = "dtui" version = "2.0.0" @@ -554,21 +533,21 @@ checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-lite" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" +checksum = "3f1fa2f9765705486b33fd2acf1577f8ec449c2ba1f318ae5447697b7c08d210" dependencies = [ "fastrand", "futures-core", @@ -579,51 +558,32 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-core", + "futures-io", "futures-sink", "futures-task", + "memchr", "pin-project-lite", "pin-utils", "slab", ] -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - [[package]] name = "gimli" version = "0.31.0" @@ -640,6 +600,12 @@ dependencies = [ "allocator-api2", ] +[[package]] +name = "hashbrown" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" + [[package]] name = "heck" version = "0.5.0" @@ -666,12 +632,12 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "indexmap" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.15.1", ] [[package]] @@ -744,7 +710,7 @@ version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37ee39891760e7d94734f6f63fedc29a2e4a152f836120753a72503f09fcf904" dependencies = [ - "hashbrown", + "hashbrown 0.14.5", ] [[package]] @@ -771,12 +737,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - [[package]] name = "miniz_oxide" version = "0.8.0" @@ -823,16 +783,6 @@ dependencies = [ "memoffset", ] -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -947,15 +897,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "ppv-lite86" -version = "0.2.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" -dependencies = [ - "zerocopy", -] - [[package]] name = "proc-macro-crate" version = "3.2.0" @@ -985,9 +926,9 @@ dependencies = [ [[package]] name = "quick-xml" -version = "0.36.1" +version = "0.36.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96a05e2e8efddfa51a84ca47cec303fac86c8541b686d37cac5efc0e094417bc" +checksum = "f7649a7b4df05aed9ea7ec6f628c67c9953a43869b8bc50929569b2999d443fe" dependencies = [ "memchr", "serde", @@ -1002,36 +943,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - [[package]] name = "ratatui" version = "0.27.0" @@ -1114,9 +1025,9 @@ checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustix" -version = "0.38.36" +version = "0.38.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f55e80d50763938498dd5ebb18647174e0c76dc38c5505294bb224624f30f36" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" dependencies = [ "bitflags", "errno", @@ -1186,17 +1097,6 @@ dependencies = [ "syn", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - [[package]] name = "sharded-slab" version = "0.1.7" @@ -1337,9 +1237,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.12.0" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" +checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" dependencies = [ "cfg-if", "fastrand", @@ -1396,9 +1296,9 @@ checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" [[package]] name = "toml_edit" -version = "0.22.20" +version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ "indexmap", "toml_datetime", @@ -1521,12 +1421,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - [[package]] name = "uds_windows" version = "1.1.0" @@ -1763,9 +1657,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.18" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] @@ -1782,30 +1676,35 @@ dependencies = [ [[package]] name = "zbus" -version = "4.4.0" -source = "git+https://github.com/dbus2/zbus.git?branch=main#60d0443ce1771559812af1f0945f0de1028a2f42" +version = "5.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e0c8d6fdd4c4ac401fd298fd169d538a386e9df3c32ff136e8745dfa443dbd8" dependencies = [ "async-broadcast", + "async-executor", + "async-fs", + "async-io", + "async-lock", "async-process", "async-recursion", + "async-task", "async-trait", + "blocking", "enumflags2", "event-listener", "futures-core", - "futures-sink", "futures-util", "hex", "nix", "ordered-stream", - "rand", "serde", "serde_repr", - "sha1", "static_assertions", "tokio", "tracing", "uds_windows", "windows-sys 0.59.0", + "winnow", "xdg-home", "zbus_macros", "zbus_names", @@ -1814,30 +1713,36 @@ dependencies = [ [[package]] name = "zbus_macros" -version = "4.4.0" -source = "git+https://github.com/dbus2/zbus.git?branch=main#60d0443ce1771559812af1f0945f0de1028a2f42" +version = "5.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed1f3cc6313cbefd539b4eee6de36a990897ab6cc2c30a82b3ac29ef9099e6c0" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", "syn", + "zbus_names", + "zvariant", "zvariant_utils", ] [[package]] name = "zbus_names" -version = "3.0.0" -source = "git+https://github.com/dbus2/zbus.git?branch=main#60d0443ce1771559812af1f0945f0de1028a2f42" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "856b7a38811f71846fd47856ceee8bccaec8399ff53fb370247e66081ace647b" dependencies = [ "serde", "static_assertions", + "winnow", "zvariant", ] [[package]] name = "zbus_xml" -version = "4.0.0" -source = "git+https://github.com/dbus2/zbus.git?branch=main#60d0443ce1771559812af1f0945f0de1028a2f42" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c210addbcb424e91411ef782a5a1e264b5a5d268766faccd7d113c7c0440b9ab" dependencies = [ "quick-xml", "serde", @@ -1852,7 +1757,6 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "byteorder", "zerocopy-derive", ] @@ -1869,21 +1773,24 @@ dependencies = [ [[package]] name = "zvariant" -version = "4.2.0" -source = "git+https://github.com/dbus2/zbus.git?branch=main#60d0443ce1771559812af1f0945f0de1028a2f42" +version = "5.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1200ee6ac32f1e5a312e455a949a4794855515d34f9909f4a3e082d14e1a56f" dependencies = [ "endi", "enumflags2", "serde", "static_assertions", + "winnow", "zvariant_derive", "zvariant_utils", ] [[package]] name = "zvariant_derive" -version = "4.2.0" -source = "git+https://github.com/dbus2/zbus.git?branch=main#60d0443ce1771559812af1f0945f0de1028a2f42" +version = "5.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "687e3b97fae6c9104fbbd36c73d27d149abf04fb874e2efbd84838763daa8916" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1894,13 +1801,14 @@ dependencies = [ [[package]] name = "zvariant_utils" -version = "2.2.0" -source = "git+https://github.com/dbus2/zbus.git?branch=main#60d0443ce1771559812af1f0945f0de1028a2f42" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20d1d011a38f12360e5fcccceeff5e2c42a8eb7f27f0dcba97a0862ede05c9c6" dependencies = [ - "nom", "proc-macro2", "quote", "serde", "static_assertions", "syn", + "winnow", ] diff --git a/Cargo.toml b/Cargo.toml index 54b93db..9787011 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ authors = ["Troels Hoffmeyer "] description = "dBus TUI for introspecting your current dbus session/system" license = "MIT" repository = "https://github.com/Troels51/dtui" -rust-version = "1.75" +rust-version = "1.80" keywords = ["tui", "dbus"] categories = ["command-line-utilities"] exclude = [ @@ -17,18 +17,18 @@ exclude = [ [dependencies] tui-tree-widget = "0.21" -zbus = { git = "https://github.com/dbus2/zbus.git", branch = "main", default-features = false, features = ["tokio"] } crossterm = "0.27" tokio = { version = "1.32", features = ["full"] } async-recursion = "1.1.1" itertools = "0.11.0" clap = { version = "4.4.1", features = ["derive"] } ratatui = { version = "0.27", features = ["macros"] } -zbus_xml = { git = "https://github.com/dbus2/zbus.git", branch = "main", default-features = false } tracing-error = "0.2.0" tracing = "0.1.40" tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json", "fmt"] } tracing-journald = "0.3.0" tui-textarea = "0.5.1" -zbus_names = { git = "https://github.com/dbus2/zbus.git", branch = "main", default-features = false } chumsky = "0.9.3" +zbus = {version = "5.1.0", features = ["tokio"]} +zbus_names = "4.1.0" +zbus_xml = "5.0.1" diff --git a/src/bin/dtui/app.rs b/src/bin/dtui/app.rs index a26280e..21508f4 100644 --- a/src/bin/dtui/app.rs +++ b/src/bin/dtui/app.rs @@ -2,7 +2,6 @@ use std::time::{Duration, Instant}; use chumsky::Parser; use crossterm::event::{self, Event, KeyCode}; -use itertools::Itertools; use ratatui::{backend::Backend, Terminal}; use tokio::sync::mpsc::Receiver; use tracing::Level; diff --git a/src/bin/dtui/main.rs b/src/bin/dtui/main.rs index 926f4a9..c8cb2c5 100644 --- a/src/bin/dtui/main.rs +++ b/src/bin/dtui/main.rs @@ -26,7 +26,7 @@ use tracing::level_filters::LevelFilter; use tracing_subscriber::layer::SubscriberExt; use tracing_subscriber::prelude::*; -use zbus::{Connection, ConnectionBuilder}; +use zbus::{conn, Connection}; #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)] enum BusType { @@ -62,9 +62,7 @@ where BusType::Session => Connection::session().await?, }; if let Some(address) = args.address { - connection = ConnectionBuilder::address(address.as_str())? - .build() - .await?; + connection = conn::Builder::address(address.as_str())?.build().await?; } let (dbus_handler_sender, app_receiver) = mpsc::channel::(16); let dbus_handler = DbusActorHandle::new(dbus_handler_sender, connection); diff --git a/src/bin/dtui/parser.rs b/src/bin/dtui/parser.rs index 088a1b4..95af5bf 100644 --- a/src/bin/dtui/parser.rs +++ b/src/bin/dtui/parser.rs @@ -1,8 +1,8 @@ use chumsky::prelude::*; -use std::{collections::HashMap, u32}; -use zbus::zvariant::{self, parsed, ObjectPath, Signature, StructureBuilder}; +use std::{collections::HashMap, str::FromStr, u32}; +use zbus::zvariant::{self, ObjectPath, Signature, StructureBuilder}; -/// Create a parser from a parsed::Signature. +/// Create a parser from a Signature. /// The language that this parses is a human readable version of the dbus format. /// Arrays are delimited by [], with values seperated by "," /// Structure are delimited by (), with values seperated by "," @@ -13,36 +13,34 @@ use zbus::zvariant::{self, parsed, ObjectPath, Signature, StructureBuilder}; /// {"first": 1, "second": 2} is a dictionary with string as key type and key type of some number, it's signature is "a{su}" /// /// ``` -/// let signature = parsed::Signature::from_str("as").unwrap(); +/// let signature = Signature::from_str("as").unwrap(); /// let result = get_parser(signature).parse("[\"first\", \"second\"]"); /// assert_eq!(result, Ok(zvariant::Value::Array(vec!["first", "second"].into()))); /// ``` pub fn get_parser( - signature: parsed::Signature, + signature: Signature, ) -> impl Parser, Error = Simple> { match signature { - zvariant::parsed::Signature::Unit => todo!(), - zvariant::parsed::Signature::U8 => parser_u8().boxed(), - zvariant::parsed::Signature::Bool => parser_bool().boxed(), - zvariant::parsed::Signature::I16 => parser_i16().boxed(), - zvariant::parsed::Signature::U16 => parser_u16().boxed(), - zvariant::parsed::Signature::I32 => parser_i32().boxed(), - zvariant::parsed::Signature::U32 => parser_u32().boxed(), - zvariant::parsed::Signature::I64 => parser_i64().boxed(), - zvariant::parsed::Signature::U64 => parser_u64().boxed(), - zvariant::parsed::Signature::F64 => parser_f64().boxed(), - zvariant::parsed::Signature::Str => parser_string().boxed(), - zvariant::parsed::Signature::Signature => parser_signature().boxed(), - zvariant::parsed::Signature::ObjectPath => parser_object_path().boxed(), - zvariant::parsed::Signature::Variant => parser_variant().boxed(), - zvariant::parsed::Signature::Fd => parser_fd().boxed(), - zvariant::parsed::Signature::Array(array) => { - parser_array(array.signature().clone()).boxed() - } - zvariant::parsed::Signature::Dict { key, value } => { + zvariant::Signature::Unit => todo!(), + zvariant::Signature::U8 => parser_u8().boxed(), + zvariant::Signature::Bool => parser_bool().boxed(), + zvariant::Signature::I16 => parser_i16().boxed(), + zvariant::Signature::U16 => parser_u16().boxed(), + zvariant::Signature::I32 => parser_i32().boxed(), + zvariant::Signature::U32 => parser_u32().boxed(), + zvariant::Signature::I64 => parser_i64().boxed(), + zvariant::Signature::U64 => parser_u64().boxed(), + zvariant::Signature::F64 => parser_f64().boxed(), + zvariant::Signature::Str => parser_string().boxed(), + zvariant::Signature::Signature => parser_signature().boxed(), + zvariant::Signature::ObjectPath => parser_object_path().boxed(), + zvariant::Signature::Variant => parser_variant().boxed(), + zvariant::Signature::Fd => parser_fd().boxed(), + zvariant::Signature::Array(array) => parser_array(array.signature().clone()).boxed(), + zvariant::Signature::Dict { key, value } => { parser_dict(key.signature().clone(), value.signature().clone()).boxed() } - zvariant::parsed::Signature::Structure(structure) => parser_struct(structure).boxed(), + zvariant::Signature::Structure(structure) => parser_struct(structure).boxed(), } } @@ -58,11 +56,11 @@ fn parser_variant<'a>() -> impl Parser, Error = S } // fn parser_struct<'a>( - structure: parsed::FieldsSignatures, + structure: zvariant::signature::Fields, ) -> impl Parser, Error = Simple> { let mut element_parsers = structure .iter() - .map(|signature: &zbus::zvariant::parsed::Signature| get_parser(signature.clone())); + .map(|signature: &zbus::zvariant::Signature| get_parser(signature.clone())); let mut full_parser = just('(').map(|_| Vec::>::new()).boxed(); // The map is there to get types to match as the chain in the loop needs the parser to output a Vec full_parser = full_parser.chain(element_parsers.next().unwrap()).boxed(); // The first doesnt get a ',' the rest do for element_parser in element_parsers { @@ -80,8 +78,8 @@ fn parser_struct<'a>( }) } fn parser_dict<'a>( - key_type: parsed::Signature, - value_type: parsed::Signature, + key_type: Signature, + value_type: Signature, ) -> impl Parser, Error = Simple> { let key_parser = get_parser(key_type.clone()); let value_parser = get_parser(value_type.clone()); @@ -99,7 +97,7 @@ fn parser_dict<'a>( .map( move |m: HashMap, zvariant::Value<'_>>| { let mut dict = - zvariant::Dict::new(key_type.clone().into(), value_type.clone().into()); + zvariant::Dict::new(&key_type, &value_type); for (k, v) in m { dict.append(k, v).expect("Could not append to key value pair, this should not happen if types are correct"); } @@ -109,7 +107,7 @@ fn parser_dict<'a>( } fn parser_array<'a>( - signature: parsed::Signature, + signature: Signature, ) -> impl Parser, Error = Simple> { let element_parser = get_parser(signature.clone()).boxed(); element_parser @@ -119,7 +117,7 @@ fn parser_array<'a>( .flatten() .delimited_by(just('['), just(']')) .map(move |v: Vec>| { - let mut array: zvariant::Array<'_> = zvariant::Array::new(signature.clone().into()); + let mut array: zvariant::Array<'_> = zvariant::Array::new(&signature); for element in v { array .append(element) @@ -262,7 +260,7 @@ fn parser_signature() -> impl Parser, Error = Sim .then_ignore(just('"')) .collect::() .try_map(|digits, span| { - if let Ok(signature) = Signature::try_from(digits) { + if let Ok(signature) = Signature::from_str(digits.as_str()) { Ok(zvariant::Value::Signature(signature)) } else { Err(Simple::custom( @@ -331,7 +329,7 @@ fn parser_fd() -> impl Parser, Error = Simple) -> Vec = method .args() .iter() .filter(|arg| arg.direction().is_some_and(|s| s == ArgDirection::Out)) - .map(|arg| format!("{}: {}", arg.name().unwrap_or_default(), arg.ty())) + .map(|arg| { + format!( + "{}: {}", + arg.name().unwrap_or_default(), + arg.ty().to_string() + ) + }) .collect(); let return_arrow = if outputs.is_empty() { "" } else { "=>" }; // If we dont return anything, the arrow shouldnt be there let leaf_string: String = format!( @@ -146,7 +158,7 @@ fn node_to_treeitems(node: &zbus_xml::Node<'static>) -> Vec) -> Vec(frame: &mut Frame, app: &mut App) { Block::default() .borders(Borders::ALL) .title(format!("name: {} | {}", arg.name().unwrap(), inout)) - .title_bottom(format!("type: {}", arg.ty())), + .title_bottom(format!("type: {}", arg.ty().to_string())), ); let parser = get_parser( - zvariant::parsed::Signature::from_str(arg.ty().signature().as_str()) + zvariant::Signature::from_str(arg.ty().to_string().as_str()) .expect("The type description for the method we got was not good"), ); let input = match arg.direction().unwrap_or(zbus_xml::ArgDirection::In) {