1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
This patch is based on manually applying fixes from
https://github.com/dbus2/zbus/commit/fd5a4fa5f446320a4eee952288b338382a5d14ab
to the zbus 1.x codebase.
Be aware that this patch only works with a correspondingly patched version
of zvariant 2.x. Using it with the zvariant crate from crates.io will not
work.
Index: rust-zbus-1-1.9.3/Cargo.toml
===================================================================
--- rust-zbus-1-1.9.3.orig/Cargo.toml
+++ rust-zbus-1-1.9.3/Cargo.toml
@@ -40,7 +40,7 @@ version = "1.3.1"
version = "2.1"
[dependencies.enumflags2]
-version = "0.6.4"
+version = "0.7.7"
features = ["serde"]
[dependencies.fastrand]
Index: rust-zbus-1-1.9.3/src/fdo.rs
===================================================================
--- rust-zbus-1-1.9.3.orig/src/fdo.rs
+++ rust-zbus-1-1.9.3/src/fdo.rs
@@ -3,7 +3,7 @@
//! The D-Bus specification defines the message bus messages and some standard interfaces that may
//! be useful across various D-Bus applications. This module provides their proxy.
-use enumflags2::BitFlags;
+use enumflags2::{bitflags,BitFlags};
use serde::{Deserialize, Serialize};
use serde_repr::{Deserialize_repr, Serialize_repr};
use std::collections::HashMap;
@@ -114,8 +114,9 @@ trait Stats {
/// The flags used by the bus [`request_name`] method.
///
/// [`request_name`]: struct.DBusProxy.html#method.request_name
+#[bitflags]
#[repr(u32)]
-#[derive(Type, BitFlags, Debug, PartialEq, Copy, Clone, Serialize, Deserialize)]
+#[derive(Type, Debug, PartialEq, Copy, Clone, Serialize, Deserialize)]
pub enum RequestNameFlags {
/// If an application A specifies this flag and succeeds in becoming the owner of the name, and
/// another application B later calls [`request_name`] with the [`ReplaceExisting`] flag, then
Index: rust-zbus-1-1.9.3/src/lib.rs
===================================================================
--- rust-zbus-1-1.9.3.orig/src/lib.rs
+++ rust-zbus-1-1.9.3/src/lib.rs
@@ -207,7 +207,7 @@ mod tests {
os::unix::io::{AsRawFd, FromRawFd},
};
- use enumflags2::BitFlags;
+ use enumflags2::{bitflags,BitFlags};
use serde_repr::{Deserialize_repr, Serialize_repr};
use zvariant::{derive::Type, Fd, OwnedValue, Type};
@@ -313,4 +313,5 @@ mod tests {
// Let's try getting us a fancy name on the bus
+ #[bitflags]
#[repr(u32)]
- #[derive(Type, BitFlags, Debug, PartialEq, Copy, Clone)]
+ #[derive(Type, Debug, PartialEq, Copy, Clone)]
enum RequestNameFlags {
Index: rust-zbus-1-1.9.3/src/message_header.rs
===================================================================
--- rust-zbus-1-1.9.3.orig/src/message_header.rs
+++ rust-zbus-1-1.9.3/src/message_header.rs
@@ -1,6 +1,6 @@
use std::convert::TryFrom;
-use enumflags2::BitFlags;
+use enumflags2::{bitflags,BitFlags};
use serde::{Deserialize, Serialize};
use serde_repr::{Deserialize_repr, Serialize_repr};
@@ -72,8 +72,9 @@ impl From<u8> for MessageType {
}
/// Pre-defined flags that can be passed in Message header.
+#[bitflags]
#[repr(u8)]
-#[derive(Debug, Copy, Clone, PartialEq, BitFlags, Type)]
+#[derive(Debug, Copy, Clone, PartialEq, Type)]
pub enum MessageFlags {
/// This message does not expect method return replies or error replies, even if it is of a type
/// that can have a reply; the reply should be omitted.
|