fix: broken example in docs
A few of the examples binds a session to _
which immediately destructs in rust. As such, the example does not behave as expected (the user is unable to find the dbus service/object using command line tools, nor can they message it).
The fix is trivial:
0001-docs-fix-broken-example-that-immediately-destructed-.patch
From 264bc7f30a44f6638d6505359304521beb9a9321 Mon Sep 17 00:00:00 2001
From: OliverNChalk <11343499+OliverNChalk@users.noreply.github.com>
Date: Sat, 6 May 2023 13:02:30 -0500
Subject: [PATCH] docs: fix broken example that immediately destructed session
---
From bb4f230cc8c9a2b70a9c3063f8b68a83e1e6813c Mon Sep 17 00:00:00 2001
From: OliverNChalk <11343499+OliverNChalk@users.noreply.github.com>
Date: Sat, 6 May 2023 13:02:30 -0500
Subject: [PATCH] docs: fix broken example that immediately destructed session
---
book/src/blocking.md | 2 +-
book/src/server.md | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/book/src/blocking.md b/book/src/blocking.md
index 9b1f2093..0dd8e815 100644
--- a/book/src/blocking.md
+++ b/book/src/blocking.md
@@ -188,7 +188,7 @@ fn main() -> Result<(), Box<dyn Error>> {
done: event_listener::Event::new(),
};
let done_listener = greeter.done.listen();
- let _ = ConnectionBuilder::session()?
+ let _handle = ConnectionBuilder::session()?
.name("org.zbus.MyGreeter")?
.serve_at("/org/zbus/MyGreeter", greeter)?
.build()?;
diff --git a/book/src/server.md b/book/src/server.md
index 552b2de5..449e09d6 100644
--- a/book/src/server.md
+++ b/book/src/server.md
@@ -163,7 +163,7 @@ setting up your interfaces and requesting names, and not have to care about this
#
# #[async_std::main]
# async fn main() -> Result<()> {
- let _ = ConnectionBuilder::session()?
+ let _handle = ConnectionBuilder::session()?
.name("org.zbus.MyGreeter")?
.serve_at("/org/zbus/MyGreeter", Greeter)?
.build()
@@ -262,7 +262,7 @@ async fn main() -> Result<()> {
done: event_listener::Event::new(),
};
let done_listener = greeter.done.listen();
- let _ = ConnectionBuilder::session()?
+ let _handle = ConnectionBuilder::session()?
.name("org.zbus.MyGreeter")?
.serve_at("/org/zbus/MyGreeter", greeter)?
.build()
--
2.40.0
Edited by Oliver Chalk