aboutsummaryrefslogtreecommitdiffhomepage
path: root/system/dbus
diff options
context:
space:
mode:
Diffstat (limited to 'system/dbus')
-rw-r--r--system/dbus/address.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/system/dbus/address.go b/system/dbus/address.go
index bec49e62..edee7e20 100644
--- a/system/dbus/address.go
+++ b/system/dbus/address.go
@@ -13,6 +13,13 @@ type AddrEntry struct {
Values [][2]string `json:"values"`
}
+// EqualAddrEntries returns whether two slices of [AddrEntry] are equal.
+func EqualAddrEntries(entries, target []AddrEntry) bool {
+ return slices.EqualFunc(entries, target, func(a AddrEntry, b AddrEntry) bool {
+ return a.Method == b.Method && slices.Equal(a.Values, b.Values)
+ })
+}
+
// Parse parses D-Bus address according to
// https://dbus.freedesktop.org/doc/dbus-specification.html#addresses
func Parse(addr []byte) ([]AddrEntry, error) {