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`.
This commit is contained in:
Ian Douglas Scott 2024-10-28 14:22:30 -07:00 committed by Michael Murphy
parent ac5713df52
commit 3b86984332
26 changed files with 30 additions and 32 deletions

View file

@ -24,5 +24,5 @@ serde = { version = "1.0", features = ["derive"] }
thiserror = "1.0" thiserror = "1.0"
time = { version = "0.3", features = ["parsing"] } time = { version = "0.3", features = ["parsing"] }
tracing = "0.1.40" tracing = "0.1.40"
zbus = { version = "4.2.1" } zbus = { version = "5.7.1" }
zvariant = { version = "4.1.0" } zvariant = { version = "5.5.3" }

View file

@ -30,7 +30,7 @@ use crate::{UserProxy, UserProxyBlocking};
default_service = "org.freedesktop.Accounts", default_service = "org.freedesktop.Accounts",
default_path = "/org/freedesktop/Accounts" default_path = "/org/freedesktop/Accounts"
)] )]
trait Accounts { pub trait Accounts {
/// CacheUser method /// CacheUser method
fn cache_user(&self, name: &str) -> zbus::Result<zbus::zvariant::OwnedObjectPath>; fn cache_user(&self, name: &str) -> zbus::Result<zbus::zvariant::OwnedObjectPath>;

View file

@ -28,7 +28,7 @@ use zbus::proxy;
default_service = "org.freedesktop.Accounts", default_service = "org.freedesktop.Accounts",
// default_path = "/org/freedesktop/Accounts/User1000" // default_path = "/org/freedesktop/Accounts/User1000"
)] )]
trait User { pub trait User {
/// GetPasswordExpirationPolicy method /// GetPasswordExpirationPolicy method
fn get_password_expiration_policy(&self) -> zbus::Result<(i64, i64, i64, i64, i64, i64)>; fn get_password_expiration_policy(&self) -> zbus::Result<(i64, i64, i64, i64, i64, i64)>;

View file

@ -20,7 +20,7 @@
//! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces, //! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces,
use zbus::proxy; use zbus::proxy;
#[proxy(interface = "org.bluez.Adapter1", default_service = "org.bluez")] #[proxy(interface = "org.bluez.Adapter1", default_service = "org.bluez")]
trait Adapter1 { pub trait Adapter1 {
/// ConnectDevice method /// ConnectDevice method
fn connect_device( fn connect_device(
&self, &self,

View file

@ -23,7 +23,7 @@ use zbus::proxy;
default_service = "org.bluez", default_service = "org.bluez",
default_path = "/org/bluez" default_path = "/org/bluez"
)] )]
trait AgentManager1 { pub trait AgentManager1 {
/// RegisterAgent method /// RegisterAgent method
fn register_agent( fn register_agent(
&self, &self,

View file

@ -20,7 +20,7 @@
//! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces, //! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces,
use zbus::proxy; use zbus::proxy;
#[proxy(interface = "org.bluez.Battery1", default_service = "org.bluez")] #[proxy(interface = "org.bluez.Battery1", default_service = "org.bluez")]
trait Battery1 { pub trait Battery1 {
/// Percentage property /// Percentage property
#[zbus(property)] #[zbus(property)]
fn percentage(&self) -> zbus::Result<u8>; fn percentage(&self) -> zbus::Result<u8>;

View file

@ -22,7 +22,7 @@
//! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces, //! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces,
use zbus::proxy; use zbus::proxy;
#[proxy(interface = "org.bluez.Device1", default_service = "org.bluez")] #[proxy(interface = "org.bluez.Device1", default_service = "org.bluez")]
trait Device1 { pub trait Device1 {
/// CancelPairing method /// CancelPairing method
fn cancel_pairing(&self) -> zbus::Result<()>; fn cancel_pairing(&self) -> zbus::Result<()>;

View file

@ -23,7 +23,7 @@ use zbus::proxy;
default_service = "org.bluez", default_service = "org.bluez",
default_path = "/org/bluez" default_path = "/org/bluez"
)] )]
trait HealthManager1 { pub trait HealthManager1 {
/// CreateApplication method /// CreateApplication method
fn create_application( fn create_application(
&self, &self,

View file

@ -25,7 +25,7 @@ use zbus::proxy;
default_service = "org.bluez", default_service = "org.bluez",
default_path = "/org/bluez" default_path = "/org/bluez"
)] )]
trait ProfileManager1 { pub trait ProfileManager1 {
/// RegisterProfile method /// RegisterProfile method
fn register_profile( fn register_profile(
&self, &self,

View file

@ -26,7 +26,7 @@ use zbus::{names::OwnedWellKnownName, proxy};
default_service = "com.system76.CosmicSettingsDaemon", default_service = "com.system76.CosmicSettingsDaemon",
default_path = "/com/system76/CosmicSettingsDaemon" default_path = "/com/system76/CosmicSettingsDaemon"
)] )]
trait CosmicSettingsDaemon { pub trait CosmicSettingsDaemon {
/// DecreaseDisplayBrightness method /// DecreaseDisplayBrightness method
fn decrease_display_brightness(&self) -> zbus::Result<()>; fn decrease_display_brightness(&self) -> zbus::Result<()>;
@ -68,7 +68,7 @@ trait CosmicSettingsDaemon {
interface = "com.system76.CosmicSettingsDaemon.Config", interface = "com.system76.CosmicSettingsDaemon.Config",
default_service = "com.system76.CosmicSettingsDaemon.Config" default_service = "com.system76.CosmicSettingsDaemon.Config"
)] )]
trait Config { pub trait Config {
/// Changed signal /// Changed signal
#[zbus(signal)] #[zbus(signal)]
async fn changed(&self, id: String, key: String) -> zbus::Result<()>; async fn changed(&self, id: String, key: String) -> zbus::Result<()>;

View file

@ -48,7 +48,7 @@ impl TryFrom<OwnedValue> for Accuracy {
interface = "org.freedesktop.GeoClue2.Manager", interface = "org.freedesktop.GeoClue2.Manager",
default_path = "/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. /// 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")] #[zbus(object = "Client")]
fn get_client(&self); fn get_client(&self);
@ -72,7 +72,7 @@ trait Manager {
default_service = "org.freedesktop.GeoClue2", default_service = "org.freedesktop.GeoClue2",
interface = "org.freedesktop.GeoClue2.Client" interface = "org.freedesktop.GeoClue2.Client"
)] )]
trait Client { pub trait Client {
/// Start method /// Start method
fn start(&self) -> zbus::Result<()>; fn start(&self) -> zbus::Result<()>;
@ -123,7 +123,7 @@ trait Client {
default_service = "org.freedesktop.GeoClue2", default_service = "org.freedesktop.GeoClue2",
interface = "org.freedesktop.GeoClue2.Location" interface = "org.freedesktop.GeoClue2.Location"
)] )]
trait Location { pub trait Location {
/// The latitude of the location, in degrees. /// The latitude of the location, in degrees.
#[zbus(property)] #[zbus(property)]
fn latitude(&self) -> Result<f64>; fn latitude(&self) -> Result<f64>;

View file

@ -9,7 +9,7 @@ categories = ["os::linux-apis"]
keywords = ["dbus", "hostname", "hostname1", "zbus", "freedesktop"] keywords = ["dbus", "hostname", "hostname1", "zbus", "freedesktop"]
[dependencies] [dependencies]
zbus = "4.2.1" zbus.workspace = true
[dev-dependencies] [dev-dependencies]
pico-args = "0.5.0" pico-args = "0.5.0"

View file

@ -26,7 +26,7 @@ use zbus::proxy;
default_service = "org.freedesktop.hostname1", default_service = "org.freedesktop.hostname1",
default_path = "/org/freedesktop/hostname1" default_path = "/org/freedesktop/hostname1"
)] )]
trait Hostname1 { pub trait Hostname1 {
/// Describe method /// Describe method
fn describe(&self) -> zbus::Result<String>; fn describe(&self) -> zbus::Result<String>;

View file

@ -9,7 +9,7 @@ use zbus::proxy;
default_service = "org.freedesktop.locale1", default_service = "org.freedesktop.locale1",
default_path = "/org/freedesktop/locale1" default_path = "/org/freedesktop/locale1"
)] )]
trait locale1 { pub trait locale1 {
/// SetLocale method /// SetLocale method
fn set_locale(&self, locale: &[&str], interactive: bool) -> zbus::Result<()>; fn set_locale(&self, locale: &[&str], interactive: bool) -> zbus::Result<()>;

View file

@ -26,7 +26,7 @@ use zbus::proxy;
interface = "org.mpris.MediaPlayer2", interface = "org.mpris.MediaPlayer2",
default_path = "/org/mpris/MediaPlayer2" default_path = "/org/mpris/MediaPlayer2"
)] )]
trait MediaPlayer2 { pub trait MediaPlayer2 {
/// Quit method /// Quit method
fn quit(&self) -> zbus::Result<()>; fn quit(&self) -> zbus::Result<()>;

View file

@ -27,7 +27,7 @@ use zbus::proxy;
interface = "org.mpris.MediaPlayer2.Player", interface = "org.mpris.MediaPlayer2.Player",
default_path = "/org/mpris/MediaPlayer2" default_path = "/org/mpris/MediaPlayer2"
)] )]
trait Player { pub trait Player {
/// Next method /// Next method
fn next(&self) -> zbus::Result<()>; fn next(&self) -> zbus::Result<()>;

View file

@ -26,7 +26,7 @@ use zbus::proxy;
interface = "org.mpris.MediaPlayer2.Playlists", interface = "org.mpris.MediaPlayer2.Playlists",
default_path = "/org/mpris/MediaPlayer2" default_path = "/org/mpris/MediaPlayer2"
)] )]
trait Playlists { pub trait Playlists {
/// ActivatePlaylist method /// ActivatePlaylist method
fn activate_playlist(&self, playlist_id: &PlaylistId) -> zbus::Result<()>; fn activate_playlist(&self, playlist_id: &PlaylistId) -> zbus::Result<()>;

View file

@ -26,7 +26,7 @@ use zbus::proxy;
interface = "org.mpris.MediaPlayer2.TrackList", interface = "org.mpris.MediaPlayer2.TrackList",
default_path = "/org/mpris/MediaPlayer2" default_path = "/org/mpris/MediaPlayer2"
)] )]
trait TrackList { pub trait TrackList {
/// AddTrack method /// AddTrack method
fn add_track(&self, uri: &str, after_track: &TrackId, set_as_current: bool) fn add_track(&self, uri: &str, after_track: &TrackId, set_as_current: bool)
-> zbus::Result<()>; -> zbus::Result<()>;

View file

@ -25,9 +25,7 @@ pub enum PlaylistOrdering {
} }
impl Type for PlaylistOrdering { impl Type for PlaylistOrdering {
fn signature() -> Signature<'static> { const SIGNATURE: &'static Signature = String::SIGNATURE;
String::signature()
}
} }
impl<'a> TryFrom<Value<'a>> for PlaylistOrdering { impl<'a> TryFrom<Value<'a>> for PlaylistOrdering {

View file

@ -26,7 +26,7 @@ use zbus::proxy;
interface = "org.freedesktop.NetworkManager.AccessPoint", interface = "org.freedesktop.NetworkManager.AccessPoint",
default_service = "org.freedesktop.NetworkManager" default_service = "org.freedesktop.NetworkManager"
)] )]
trait AccessPoint { pub trait AccessPoint {
/// Flags property /// Flags property
#[zbus(property)] #[zbus(property)]
fn flags(&self) -> zbus::Result<u32>; fn flags(&self) -> zbus::Result<u32>;

View file

@ -26,7 +26,7 @@ use zbus::proxy;
interface = "org.freedesktop.NetworkManager.Device.Wired", interface = "org.freedesktop.NetworkManager.Device.Wired",
default_service = "org.freedesktop.NetworkManager" default_service = "org.freedesktop.NetworkManager"
)] )]
trait WiredDevice { pub trait WiredDevice {
/// Carrier property /// Carrier property
#[zbus(property)] #[zbus(property)]
fn carrier(&self) -> zbus::Result<bool>; fn carrier(&self) -> zbus::Result<bool>;

View file

@ -31,7 +31,7 @@ use zbus::{
default_service = "net.hadess.SwitcherooControl", default_service = "net.hadess.SwitcherooControl",
default_path = "/net/hadess/SwitcherooControl" default_path = "/net/hadess/SwitcherooControl"
)] )]
trait SwitcherooControl { pub trait SwitcherooControl {
/// GPUs property /// GPUs property
#[zbus(property, name = "GPUs")] #[zbus(property, name = "GPUs")]
fn gpus( fn gpus(

View file

@ -22,7 +22,7 @@ use zbus::proxy;
default_service = "org.freedesktop.timedate1", default_service = "org.freedesktop.timedate1",
default_path = "/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. /// A list of time zones known on the local system as an array of names.
fn list_timezones(&self) -> zbus::Result<Vec<String>>; fn list_timezones(&self) -> zbus::Result<Vec<String>>;

View file

@ -68,7 +68,7 @@ pub enum BatteryLevel {
default_service = "org.freedesktop.UPower", default_service = "org.freedesktop.UPower",
assume_defaults = false assume_defaults = false
)] )]
trait Device { pub trait Device {
#[zbus(property)] #[zbus(property)]
fn battery_level(&self) -> zbus::Result<BatteryLevel>; fn battery_level(&self) -> zbus::Result<BatteryLevel>;

View file

@ -8,7 +8,7 @@ use zbus::proxy;
interface = "org.freedesktop.UPower.KbdBacklight", interface = "org.freedesktop.UPower.KbdBacklight",
default_path = "/org/freedesktop/UPower/KbdBacklight" default_path = "/org/freedesktop/UPower/KbdBacklight"
)] )]
trait KbdBacklight { pub trait KbdBacklight {
/// GetBrightness method /// GetBrightness method
fn get_brightness(&self) -> zbus::Result<i32>; fn get_brightness(&self) -> zbus::Result<i32>;

View file

@ -6,7 +6,7 @@ use zbus::proxy;
use crate::device::{DeviceProxy, DeviceProxyBlocking}; use crate::device::{DeviceProxy, DeviceProxyBlocking};
#[proxy(interface = "org.freedesktop.UPower", assume_defaults = true)] #[proxy(interface = "org.freedesktop.UPower", assume_defaults = true)]
trait UPower { pub trait UPower {
/// EnumerateDevices method /// EnumerateDevices method
fn enumerate_devices(&self) -> zbus::Result<Vec<zbus::zvariant::OwnedObjectPath>>; fn enumerate_devices(&self) -> zbus::Result<Vec<zbus::zvariant::OwnedObjectPath>>;