Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
Z

zbus

> 编程语言
Open source

Rust D-Bus crate.

727 stars0 likes0 views
WebsiteGitHub

About

Rust D-Bus crate.

zbus

A Rust API for D-Bus communication. The goal is to provide a safe and simple high- and low-level API akin to GDBus, that doesn't depend on C libraries.

The project is divided into the following subcrates:

  • zbus: The main subcrate. It provides the API to interact with D-Bus, the D-Bus wire format (what used to be the zvariant crate) and the bus name types (what used to be the zbus_names crate). With default-features = false you get the wire format and the name types alone, without any of the D-Bus API.
  • zbus_macros: The procedural macros behind #[proxy], #[interface], #[derive(DBusError)] and the wire-format derives. zbus re-exports all of them, so you rarely depend on it directly.
  • zbus_xml: API to handle D-Bus introspection description XML.
  • zbus_xmlgen: A developer tool to generate Rust code from D-Bus interface description XML.
  • zbus_utils: The D-Bus signature parser, name validators and derive-macro plumbing shared by zbus and zbus_macros.

zgvariant is a sibling project. It implements GVariant, the format zbus itself dropped in 6.0. From its 2.0 release it builds on zbus_utils too, so its signature type is the same one zbus uses; zgvariant 1.x depends on zvariant_utils 4.x — this crate under its old name — and its signature type is a distinct one.

Getting Started

The best way to get started with zbus is the book, where we start with basic D-Bus concepts and explain with code samples, how zbus makes D-Bus easy.

Example code

We'll create a simple D-Bus service and client to demonstrate the usage of zbus. Note that these examples assume that a D-Bus broker is setup on your machine and you've a session bus running (DBUS_SESSION_BUS_ADDRESS environment variable must be set). This is guaranteed to be the case on a typical Linux desktop session.

Service

A simple service that politely greets whoever calls its SayHello method:

…

You can use the following command to test it:

bash
$ busctl --user call org.zbus.MyGreeter /org/zbus/MyGreeter org.zbus.MyGreeter1 SayHello s "Maria"
s "Hello Maria! I have been called 1 times."

Client

Now let's write the client-side code for MyGreeter service:

…

Getting Help

If you need help in using these crates, are looking for ways to contribute, or just want to hang out with the cool kids, please come chat with us in the #zbus:matrix.org Matrix room. If something doesn't seem right, please file an issue.

Security

If you discover a security vulnerability, please report it privately following our Security Policy. We take security seriously and will respond promptly to reports.

Portability

Supported targets include Unix, Windows and macOS with Linux as the main target. Integration tests of zbus crate currently require a session bus running on the build host.

License

MIT license LICENSE-MIT

Alternative Crates

dbus-rs relies on the battle tested libdbus C library to send and receive messages. Companion crates add Tokio support, server builder without macros, and code generation.

There are many other D-Bus crates out there with various levels of maturity and features.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rust

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言