Skip to content

Commit

Permalink
Deploying to gh-pages from @ fa01a0d 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
zeenix committed Oct 19, 2024
1 parent 5410c22 commit 61d4743
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 53 deletions.
13 changes: 8 additions & 5 deletions blocking.html
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ <h1 id="blocking-api"><a class="header" href="#blocking-api">Blocking API</a></h
in panics and hangs. This is not a limitation of zbus but rather a
<a href="https://rust-lang.github.io/wg-async-foundations/vision/shiny_future/users_manual.html#caveat-beware-the-async-sandwich">well-known general problem</a> in the Rust async/await world. The <a href="https://docs.rs/blocking/"><code>blocking</code> crate</a>,
<a href="https://docs.rs/async-std/4/async_std/task/fn.spawn_blocking.html"><code>async-std</code></a> and <a href="https://docs.rs/tokio/4/tokio/task/fn.spawn_blocking.html"><code>tokio</code></a> crates provide a easy way around this problem.</p>
<p><strong>Note:</strong> Since zbus 5.0, blocking API can be disabled through the <code>blocking-api</code> cargo feature. If
you use this API, make sure you are not unintentionally disabling it by disabling the default
features in your <code>Cargo.toml</code>.</p>
<h2 id="establishing-a-connection"><a class="header" href="#establishing-a-connection">Establishing a connection</a></h2>
<p>The only difference to that of <a href="https://docs.rs/zbus/4/zbus/connection/struct.Connection.html">asynchronous <code>Connection</code> API</a> is that you use
<a href="https://docs.rs/zbus/4/zbus/blocking/connection/struct.Connection.html"><code>blocking::Connection</code></a> type instead. This type’s API is almost identical to that of <code>Connection</code>,
Expand Down Expand Up @@ -305,7 +308,7 @@ <h2 id="server"><a class="header" href="#server">Server</a></h2>
context. Therefore, you can not use blocking API in the method implementation directly. See note at
the beginning of this chapter for details on why and a possible workaround.</p>
<pre><pre class="playground"><code class="language-rust no_run edition2021"><span class="boring">use std::error::Error;
</span><span class="boring">use zbus::{blocking::connection, interface, fdo, SignalContext};
</span><span class="boring">use zbus::{blocking::connection, interface, fdo, object_server::SignalEmitter};
</span><span class="boring">
</span>use event_listener::{Event, Listener};

Expand All @@ -323,10 +326,10 @@ <h2 id="server"><a class="header" href="#server">Server</a></h2>
// Rude!
async fn go_away(
&amp;self,
#[zbus(signal_context)]
ctxt: SignalContext&lt;'_&gt;,
#[zbus(signal_emitter)]
emitter: SignalEmitter&lt;'_&gt;,
) -&gt; fdo::Result&lt;()&gt; {
Self::greeted_everyone(&amp;ctxt).await?;
emitter.greeted_everyone().await?;
self.done.notify(1);

Ok(())
Expand All @@ -350,7 +353,7 @@ <h2 id="server"><a class="header" href="#server">Server</a></h2>

/// A signal; the implementation is provided by the macro.
#[zbus(signal)]
async fn greeted_everyone(ctxt: &amp;SignalContext&lt;'_&gt;) -&gt; zbus::Result&lt;()&gt;;
async fn greeted_everyone(emitter: &amp;SignalEmitter&lt;'_&gt;) -&gt; zbus::Result&lt;()&gt;;
}

fn main() -&gt; Result&lt;(), Box&lt;dyn Error&gt;&gt; {
Expand Down
4 changes: 2 additions & 2 deletions client.html
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ <h1 id="writing-a-client-proxy"><a class="header" href="#writing-a-client-proxy"
<em>xmlgen</em>, a tool to help us generate a boilerplate trait from the XML of an introspected service.</p>
<p>To make this learning “hands-on”, we are going to call and bind the cross-desktop notification
service (please refer to this
<a href="https://specifications.freedesktop.org/notification-spec/notification-spec-latest.html">reference</a>
<a href="https://specifications.freedesktop.org/notification-spec/latest/">reference</a>
document for further details on this API).</p>
<p>Let’s start by playing with the service from the shell, and notify the desktop with [<code>busctl</code>]<sup class="footnote-reference"><a href="#busctl">1</a></sup>:</p>
<pre><code class="language-bash">busctl --user call \
Expand Down Expand Up @@ -734,7 +734,7 @@ <h2 id="generating-the-trait-from-an-xml-interface"><a class="header" href="#gen
implemented starting from the <em>xmlgen</em> output.</p>
<p>There you have it, a Rust-friendly binding for your D-Bus service!</p>
<div class="footnote-definition" id="busctl"><sup class="footnote-definition-label">1</sup>
<p><code>busctl</code> is part of <a href="https://www.freedesktop.org/wiki/Software/systemd/"><code>systemd</code></a>.</p>
<p><code>busctl</code> is part of <a href="https://systemd.io/"><code>systemd</code></a>.</p>
</div>

</main>
Expand Down
4 changes: 2 additions & 2 deletions concepts.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ <h2 id="bus-name--service-name"><a class="header" href="#bus-name--service-name"
are assigned a unique name by the bus at start. Since this name is not static, most services use
something called a <em>well-known bus name</em> and typically it’s this name, that you’ll be concerned
with.</p>
<p>An example would be the <a href="https://specifications.freedesktop.org/notification-spec/notification-spec-latest.html">FreeDesktop Notifications Service</a> that uses
<p>An example would be the <a href="https://specifications.freedesktop.org/notification-spec/latest/">FreeDesktop Notifications Service</a> that uses
<code>org.freedesktop.Notifications</code> as its well-known bus name.</p>
<p>For further details on bus names, please refer to the <a href="https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-bus">Bus names chapter</a> of the D-Bus specification.</p>
<h2 id="objects-and-object-paths"><a class="header" href="#objects-and-object-paths">Objects and Object paths</a></h2>
Expand All @@ -207,7 +207,7 @@ <h2 id="objects-and-object-paths"><a class="header" href="#objects-and-object-pa
these objects. These objects can be ephemeral or they could live as long as the service itself.</p>
<p>Every object is identified by a string, which is referred to as its path. An example of an object
path is <code>/org/freedesktop/Notifications</code>, which identities the only object exposed by the
<a href="https://specifications.freedesktop.org/notification-spec/notification-spec-latest.html">FreeDesktop Notifications Service</a>.</p>
<a href="https://specifications.freedesktop.org/notification-spec/latest/">FreeDesktop Notifications Service</a>.</p>
<p>For further details on object paths, please refer to the <a href="https://dbus.freedesktop.org/doc/dbus-specification.html#basic-types">Basic types chapter</a> of the D-Bus
specification.</p>
<h2 id="interfaces"><a class="header" href="#interfaces">Interfaces</a></h2>
Expand Down
2 changes: 1 addition & 1 deletion connection.html
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ <h1 id="establishing-a-connection"><a class="header" href="#establishing-a-conne
<h2 id="connection-to-the-bus"><a class="header" href="#connection-to-the-bus">Connection to the bus</a></h2>
<p>To connect to the session bus (the <em>per-user</em> bus), simply call <code>Connection::session()</code>. It
returns an instance of the connection (if all went well). Similarly, to connect to the system bus
(to communicate with services such as <a href="https://developer.gnome.org/NetworkManager/stable/spec.html">NetworkManager</a>, <a href="https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc">BlueZ</a> or <a href="https://www.freedesktop.org/wiki/Software/systemd/dbus/">PID1</a>), use
(to communicate with services such as <a href="https://developer.gnome.org/NetworkManager/stable/spec.html">NetworkManager</a>, <a href="https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc">BlueZ</a> or <a href="https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.systemd1.html">PID1</a>), use
<code>Connection::system()</code>.</p>
<p>Moreover, it can be converted to a <a href="https://docs.rs/zbus/4/zbus/struct.MessageStream.html"><code>MessageStream</code></a> that implements <a href="https://docs.rs/futures/4/futures/stream/trait.Stream.html"><code>futures::stream::Stream</code></a>,
which can be used to conveniently receive messages, for the times when low-level API is
Expand Down
1 change: 0 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ <h2 id="zbus"><a class="header" href="#zbus">zbus</a></h2>
<p>The <a href="https://crates.io/crates/zbus">zbus crate</a> provides the main API you will use to interact with D-Bus from Rust. It takes care
of the establishment of a connection, the creation, sending and receiving of different kind of D-Bus
messages (method calls, signals etc) for you.</p>
<p>zbus crate is currently Unix-specific, with Linux as our main (and tested) target.</p>
<div class="footnote-definition" id="outdated"><sup class="footnote-definition-label">1</sup>
<p>D-Bus is ~15y old, unfortunately many documents out there are
sometime aging or misleading.</p>
Expand Down
1 change: 0 additions & 1 deletion introduction.html
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ <h2 id="zbus"><a class="header" href="#zbus">zbus</a></h2>
<p>The <a href="https://crates.io/crates/zbus">zbus crate</a> provides the main API you will use to interact with D-Bus from Rust. It takes care
of the establishment of a connection, the creation, sending and receiving of different kind of D-Bus
messages (method calls, signals etc) for you.</p>
<p>zbus crate is currently Unix-specific, with Linux as our main (and tested) target.</p>
<div class="footnote-definition" id="outdated"><sup class="footnote-definition-label">1</sup>
<p>D-Bus is ~15y old, unfortunately many documents out there are
sometime aging or misleading.</p>
Expand Down
Loading

0 comments on commit 61d4743

Please sign in to comment.