Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/polymeilex/slimbus
Rust D-Bus crate on a diet
https://github.com/polymeilex/slimbus
Last synced: about 2 months ago
JSON representation
Rust D-Bus crate on a diet
- Host: GitHub
- URL: https://github.com/polymeilex/slimbus
- Owner: PolyMeilex
- License: mit
- Created: 2024-02-15T03:52:21.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2024-06-13T00:32:27.000Z (6 months ago)
- Last Synced: 2024-10-11T09:48:25.788Z (2 months ago)
- Language: Rust
- Size: 55.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[zbus](https://github.com/dbus2/zbus/tree/main) but on a diet
This is basically stripped down alternative to zbus, it's only goal is to be as small as posible. No heavy deps, no async, no Windows support, no macOS support, no fancy abstractions, just a socket and message de/serialization.
```rs
fn main() -> Result<()> {
let (mut connection, mut reader) = Connection::session()?;let msg = Message::method("/org/freedesktop/DBus", "Hello")?
.destination("org.freedesktop.DBus")?
.interface("org.freedesktop.DBus")?
.build(&())?;let serial = msg.primary_header().serial_num();
let name = loop {
let msg = reader.read_socket()?;println!("Got message: {:?}", msg);
if msg.header().reply_serial() == Some(serial) {
let body: OwnedUniqueName = msg.body().deserialize()?;
break body;
}
};dbg!(name);
}
```