File: fix-example-tokio-only.patch

package info (click to toggle)
rust-zbus 5.6.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,348 kB
  • sloc: makefile: 2
file content (20 lines) | stat: -rw-r--r-- 582 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
--- a/examples/watch-systemd-jobs.rs
+++ b/examples/watch-systemd-jobs.rs
@@ -9,10 +9,17 @@
 use zbus_macros::proxy;
 use zvariant::OwnedObjectPath;
 
+#[cfg(feature="async-io")]
 fn main() {
     async_io::block_on(watch_systemd_jobs()).expect("Error listening to signal");
 }
 
+#[cfg(not(feature="async-io"))]
+fn main() {
+    let runtime = tokio::runtime::Runtime::new().unwrap();
+    runtime.block_on(watch_systemd_jobs()).expect("Error listening to signal");
+}
+
 #[proxy(
     default_service = "org.freedesktop.systemd1",
     default_path = "/org/freedesktop/systemd1",