From 3b86984332be2c930a3536ab714b843c851fa8ca Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Mon, 28 Oct 2024 14:22:30 -0700 Subject: [PATCH] Update to zbus 5.x https://github.com/dbus2/zbus/releases/tag/zbus-5.0.0 Now requires `pub` on uses of `#[proxy]` if the generated types should be `pub`. --- Cargo.toml | 4 ++-- accounts-zbus/src/accounts.rs | 2 +- accounts-zbus/src/user.rs | 2 +- bluez/src/adapter1.rs | 2 +- bluez/src/agent_manager1.rs | 2 +- bluez/src/battery1.rs | 2 +- bluez/src/device1.rs | 2 +- bluez/src/health_manager1.rs | 2 +- bluez/src/profile_manager1.rs | 2 +- cosmic-settings-daemon/src/lib.rs | 4 ++-- geoclue2/src/lib.rs | 6 +++--- hostname1/Cargo.toml | 2 +- hostname1/src/lib.rs | 2 +- locale1/src/lib.rs | 2 +- mpris2/src/bindings/media_player.rs | 2 +- mpris2/src/bindings/player.rs | 2 +- mpris2/src/bindings/playlist.rs | 2 +- mpris2/src/bindings/track_list.rs | 2 +- mpris2/src/playlists/ordering.rs | 4 +--- networkmanager/src/interface/access_point.rs | 2 +- networkmanager/src/interface/device/wired.rs | 2 +- switcheroo-control/src/lib.rs | 2 +- timedate/src/lib.rs | 2 +- upower/src/device.rs | 2 +- upower/src/kbdbacklight.rs | 2 +- upower/src/upower.rs | 2 +- 26 files changed, 30 insertions(+), 32 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 779d137..e260113 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,5 +24,5 @@ serde = { version = "1.0", features = ["derive"] } thiserror = "1.0" time = { version = "0.3", features = ["parsing"] } tracing = "0.1.40" -zbus = { version = "4.2.1" } -zvariant = { version = "4.1.0" } +zbus = { version = "5.7.1" } +zvariant = { version = "5.5.3" } diff --git a/accounts-zbus/src/accounts.rs b/accounts-zbus/src/accounts.rs index bdd9446..6db6d20 100644 --- a/accounts-zbus/src/accounts.rs +++ b/accounts-zbus/src/accounts.rs @@ -30,7 +30,7 @@ use crate::{UserProxy, UserProxyBlocking}; default_service = "org.freedesktop.Accounts", default_path = "/org/freedesktop/Accounts" )] -trait Accounts { +pub trait Accounts { /// CacheUser method fn cache_user(&self, name: &str) -> zbus::Result; diff --git a/accounts-zbus/src/user.rs b/accounts-zbus/src/user.rs index a68bcb2..fde2ee7 100644 --- a/accounts-zbus/src/user.rs +++ b/accounts-zbus/src/user.rs @@ -28,7 +28,7 @@ use zbus::proxy; default_service = "org.freedesktop.Accounts", // default_path = "/org/freedesktop/Accounts/User1000" )] -trait User { +pub trait User { /// GetPasswordExpirationPolicy method fn get_password_expiration_policy(&self) -> zbus::Result<(i64, i64, i64, i64, i64, i64)>; diff --git a/bluez/src/adapter1.rs b/bluez/src/adapter1.rs index accbb2d..ee651fb 100644 --- a/bluez/src/adapter1.rs +++ b/bluez/src/adapter1.rs @@ -20,7 +20,7 @@ //! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces, use zbus::proxy; #[proxy(interface = "org.bluez.Adapter1", default_service = "org.bluez")] -trait Adapter1 { +pub trait Adapter1 { /// ConnectDevice method fn connect_device( &self, diff --git a/bluez/src/agent_manager1.rs b/bluez/src/agent_manager1.rs index 9638f13..287b424 100644 --- a/bluez/src/agent_manager1.rs +++ b/bluez/src/agent_manager1.rs @@ -23,7 +23,7 @@ use zbus::proxy; default_service = "org.bluez", default_path = "/org/bluez" )] -trait AgentManager1 { +pub trait AgentManager1 { /// RegisterAgent method fn register_agent( &self, diff --git a/bluez/src/battery1.rs b/bluez/src/battery1.rs index 5aed142..c98bfe9 100644 --- a/bluez/src/battery1.rs +++ b/bluez/src/battery1.rs @@ -20,7 +20,7 @@ //! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces, use zbus::proxy; #[proxy(interface = "org.bluez.Battery1", default_service = "org.bluez")] -trait Battery1 { +pub trait Battery1 { /// Percentage property #[zbus(property)] fn percentage(&self) -> zbus::Result; diff --git a/bluez/src/device1.rs b/bluez/src/device1.rs index 73b5be0..2071ce0 100644 --- a/bluez/src/device1.rs +++ b/bluez/src/device1.rs @@ -22,7 +22,7 @@ //! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces, use zbus::proxy; #[proxy(interface = "org.bluez.Device1", default_service = "org.bluez")] -trait Device1 { +pub trait Device1 { /// CancelPairing method fn cancel_pairing(&self) -> zbus::Result<()>; diff --git a/bluez/src/health_manager1.rs b/bluez/src/health_manager1.rs index f57c1aa..a8aa808 100644 --- a/bluez/src/health_manager1.rs +++ b/bluez/src/health_manager1.rs @@ -23,7 +23,7 @@ use zbus::proxy; default_service = "org.bluez", default_path = "/org/bluez" )] -trait HealthManager1 { +pub trait HealthManager1 { /// CreateApplication method fn create_application( &self, diff --git a/bluez/src/profile_manager1.rs b/bluez/src/profile_manager1.rs index 5d45a82..5ab4a70 100644 --- a/bluez/src/profile_manager1.rs +++ b/bluez/src/profile_manager1.rs @@ -25,7 +25,7 @@ use zbus::proxy; default_service = "org.bluez", default_path = "/org/bluez" )] -trait ProfileManager1 { +pub trait ProfileManager1 { /// RegisterProfile method fn register_profile( &self, diff --git a/cosmic-settings-daemon/src/lib.rs b/cosmic-settings-daemon/src/lib.rs index 7493f61..4a760ca 100644 --- a/cosmic-settings-daemon/src/lib.rs +++ b/cosmic-settings-daemon/src/lib.rs @@ -26,7 +26,7 @@ use zbus::{names::OwnedWellKnownName, proxy}; default_service = "com.system76.CosmicSettingsDaemon", default_path = "/com/system76/CosmicSettingsDaemon" )] -trait CosmicSettingsDaemon { +pub trait CosmicSettingsDaemon { /// DecreaseDisplayBrightness method fn decrease_display_brightness(&self) -> zbus::Result<()>; @@ -68,7 +68,7 @@ trait CosmicSettingsDaemon { interface = "com.system76.CosmicSettingsDaemon.Config", default_service = "com.system76.CosmicSettingsDaemon.Config" )] -trait Config { +pub trait Config { /// Changed signal #[zbus(signal)] async fn changed(&self, id: String, key: String) -> zbus::Result<()>; diff --git a/geoclue2/src/lib.rs b/geoclue2/src/lib.rs index 2584fa5..f762f98 100644 --- a/geoclue2/src/lib.rs +++ b/geoclue2/src/lib.rs @@ -48,7 +48,7 @@ impl TryFrom for Accuracy { interface = "org.freedesktop.GeoClue2.Manager", default_path = "/org/freedesktop/GeoClue2/Manager" )] -trait Manager { +pub trait Manager { /// Retrieves a client object which can only be used by the calling application only. On the first call from a specific D-Bus peer, this method will create the client object but subsequent calls will return the path of the existing client. #[zbus(object = "Client")] fn get_client(&self); @@ -72,7 +72,7 @@ trait Manager { default_service = "org.freedesktop.GeoClue2", interface = "org.freedesktop.GeoClue2.Client" )] -trait Client { +pub trait Client { /// Start method fn start(&self) -> zbus::Result<()>; @@ -123,7 +123,7 @@ trait Client { default_service = "org.freedesktop.GeoClue2", interface = "org.freedesktop.GeoClue2.Location" )] -trait Location { +pub trait Location { /// The latitude of the location, in degrees. #[zbus(property)] fn latitude(&self) -> Result; diff --git a/hostname1/Cargo.toml b/hostname1/Cargo.toml index b2aa75c..5ab5c55 100644 --- a/hostname1/Cargo.toml +++ b/hostname1/Cargo.toml @@ -9,7 +9,7 @@ categories = ["os::linux-apis"] keywords = ["dbus", "hostname", "hostname1", "zbus", "freedesktop"] [dependencies] -zbus = "4.2.1" +zbus.workspace = true [dev-dependencies] pico-args = "0.5.0" diff --git a/hostname1/src/lib.rs b/hostname1/src/lib.rs index 93585b7..bc5a379 100644 --- a/hostname1/src/lib.rs +++ b/hostname1/src/lib.rs @@ -26,7 +26,7 @@ use zbus::proxy; default_service = "org.freedesktop.hostname1", default_path = "/org/freedesktop/hostname1" )] -trait Hostname1 { +pub trait Hostname1 { /// Describe method fn describe(&self) -> zbus::Result; diff --git a/locale1/src/lib.rs b/locale1/src/lib.rs index fc395a1..ce1c169 100644 --- a/locale1/src/lib.rs +++ b/locale1/src/lib.rs @@ -9,7 +9,7 @@ use zbus::proxy; default_service = "org.freedesktop.locale1", default_path = "/org/freedesktop/locale1" )] -trait locale1 { +pub trait locale1 { /// SetLocale method fn set_locale(&self, locale: &[&str], interactive: bool) -> zbus::Result<()>; diff --git a/mpris2/src/bindings/media_player.rs b/mpris2/src/bindings/media_player.rs index 80b5251..944d32d 100644 --- a/mpris2/src/bindings/media_player.rs +++ b/mpris2/src/bindings/media_player.rs @@ -26,7 +26,7 @@ use zbus::proxy; interface = "org.mpris.MediaPlayer2", default_path = "/org/mpris/MediaPlayer2" )] -trait MediaPlayer2 { +pub trait MediaPlayer2 { /// Quit method fn quit(&self) -> zbus::Result<()>; diff --git a/mpris2/src/bindings/player.rs b/mpris2/src/bindings/player.rs index 923f925..7f63078 100644 --- a/mpris2/src/bindings/player.rs +++ b/mpris2/src/bindings/player.rs @@ -27,7 +27,7 @@ use zbus::proxy; interface = "org.mpris.MediaPlayer2.Player", default_path = "/org/mpris/MediaPlayer2" )] -trait Player { +pub trait Player { /// Next method fn next(&self) -> zbus::Result<()>; diff --git a/mpris2/src/bindings/playlist.rs b/mpris2/src/bindings/playlist.rs index b1f991a..58cc055 100644 --- a/mpris2/src/bindings/playlist.rs +++ b/mpris2/src/bindings/playlist.rs @@ -26,7 +26,7 @@ use zbus::proxy; interface = "org.mpris.MediaPlayer2.Playlists", default_path = "/org/mpris/MediaPlayer2" )] -trait Playlists { +pub trait Playlists { /// ActivatePlaylist method fn activate_playlist(&self, playlist_id: &PlaylistId) -> zbus::Result<()>; diff --git a/mpris2/src/bindings/track_list.rs b/mpris2/src/bindings/track_list.rs index b40adfa..9a33673 100644 --- a/mpris2/src/bindings/track_list.rs +++ b/mpris2/src/bindings/track_list.rs @@ -26,7 +26,7 @@ use zbus::proxy; interface = "org.mpris.MediaPlayer2.TrackList", default_path = "/org/mpris/MediaPlayer2" )] -trait TrackList { +pub trait TrackList { /// AddTrack method fn add_track(&self, uri: &str, after_track: &TrackId, set_as_current: bool) -> zbus::Result<()>; diff --git a/mpris2/src/playlists/ordering.rs b/mpris2/src/playlists/ordering.rs index 432a7f0..ac2e02a 100644 --- a/mpris2/src/playlists/ordering.rs +++ b/mpris2/src/playlists/ordering.rs @@ -25,9 +25,7 @@ pub enum PlaylistOrdering { } impl Type for PlaylistOrdering { - fn signature() -> Signature<'static> { - String::signature() - } + const SIGNATURE: &'static Signature = String::SIGNATURE; } impl<'a> TryFrom> for PlaylistOrdering { diff --git a/networkmanager/src/interface/access_point.rs b/networkmanager/src/interface/access_point.rs index 02473be..a110262 100644 --- a/networkmanager/src/interface/access_point.rs +++ b/networkmanager/src/interface/access_point.rs @@ -26,7 +26,7 @@ use zbus::proxy; interface = "org.freedesktop.NetworkManager.AccessPoint", default_service = "org.freedesktop.NetworkManager" )] -trait AccessPoint { +pub trait AccessPoint { /// Flags property #[zbus(property)] fn flags(&self) -> zbus::Result; diff --git a/networkmanager/src/interface/device/wired.rs b/networkmanager/src/interface/device/wired.rs index b31097f..9c5696a 100644 --- a/networkmanager/src/interface/device/wired.rs +++ b/networkmanager/src/interface/device/wired.rs @@ -26,7 +26,7 @@ use zbus::proxy; interface = "org.freedesktop.NetworkManager.Device.Wired", default_service = "org.freedesktop.NetworkManager" )] -trait WiredDevice { +pub trait WiredDevice { /// Carrier property #[zbus(property)] fn carrier(&self) -> zbus::Result; diff --git a/switcheroo-control/src/lib.rs b/switcheroo-control/src/lib.rs index 0ad8318..30d5c8b 100644 --- a/switcheroo-control/src/lib.rs +++ b/switcheroo-control/src/lib.rs @@ -31,7 +31,7 @@ use zbus::{ default_service = "net.hadess.SwitcherooControl", default_path = "/net/hadess/SwitcherooControl" )] -trait SwitcherooControl { +pub trait SwitcherooControl { /// GPUs property #[zbus(property, name = "GPUs")] fn gpus( diff --git a/timedate/src/lib.rs b/timedate/src/lib.rs index 3601408..2ffc671 100644 --- a/timedate/src/lib.rs +++ b/timedate/src/lib.rs @@ -22,7 +22,7 @@ use zbus::proxy; default_service = "org.freedesktop.timedate1", default_path = "/org/freedesktop/timedate1" )] -trait TimeDate { +pub trait TimeDate { /// A list of time zones known on the local system as an array of names. fn list_timezones(&self) -> zbus::Result>; diff --git a/upower/src/device.rs b/upower/src/device.rs index 5893f6a..bb27812 100644 --- a/upower/src/device.rs +++ b/upower/src/device.rs @@ -68,7 +68,7 @@ pub enum BatteryLevel { default_service = "org.freedesktop.UPower", assume_defaults = false )] -trait Device { +pub trait Device { #[zbus(property)] fn battery_level(&self) -> zbus::Result; diff --git a/upower/src/kbdbacklight.rs b/upower/src/kbdbacklight.rs index 46834ee..26c5356 100644 --- a/upower/src/kbdbacklight.rs +++ b/upower/src/kbdbacklight.rs @@ -8,7 +8,7 @@ use zbus::proxy; interface = "org.freedesktop.UPower.KbdBacklight", default_path = "/org/freedesktop/UPower/KbdBacklight" )] -trait KbdBacklight { +pub trait KbdBacklight { /// GetBrightness method fn get_brightness(&self) -> zbus::Result; diff --git a/upower/src/upower.rs b/upower/src/upower.rs index 5c11604..e718088 100644 --- a/upower/src/upower.rs +++ b/upower/src/upower.rs @@ -6,7 +6,7 @@ use zbus::proxy; use crate::device::{DeviceProxy, DeviceProxyBlocking}; #[proxy(interface = "org.freedesktop.UPower", assume_defaults = true)] -trait UPower { +pub trait UPower { /// EnumerateDevices method fn enumerate_devices(&self) -> zbus::Result>;