Skip to content
This repository has been archived by the owner on May 11, 2023. It is now read-only.

Commit

Permalink
Merge branch 'requirements-for-methods' into 'main'
Browse files Browse the repository at this point in the history
book: Inform about Value conversions for properties

Closes #318

See merge request dbus/zbus!666
  • Loading branch information
zeenix committed Mar 6, 2023
2 parents 6ddfa2b + 552439a commit 73fc414
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ cargo clippy -- -D warnings
```

Please not that there are times when clippy is wrong and you know what you are doing. In such cases,
it's acceptable to tell clippy to [ignore the specific error or warning in the code](
https://github.com/rust-lang/rust-clippy#allowingdenying-lints).
it's acceptable to tell clippy to
[ignore the specific error or warning in the code](https://github.com/rust-lang/rust-clippy#allowingdenying-lints).

If you intend to contribute often or think that's very likely, we recommend you setup the following git
hooks:
Expand Down Expand Up @@ -127,7 +127,7 @@ hooks:

* Pre-push hook that goes in the `.git/hooks/pre-push` file:

```
```sh
if ! which rustup &> /dev/null; then
curl https://sh.rustup.rs -sSf | sh -s -- -y
export PATH=$PATH:$HOME/.cargo/bin
Expand Down
12 changes: 12 additions & 0 deletions book/src/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,16 @@ Environment variables:
...
```

#### Trait-bounds for property values

If you use custom types for property values, you might get a compile error for missing
`From<zvariant::Value<'_>>` and/or `From<OwnedValue>` implementations. This is because properties
are always sent as Variants on the bus, so you need to implement these conversions for your custom
types.

Not to worry though, the `zvariant` crate provides a [`Value`] and [`OwnedValue`] derive macro to
implement these conversions for you.

#### Watching for changes

By default, the proxy will cache the properties and watch for changes.
Expand Down Expand Up @@ -556,5 +566,7 @@ There you have it, a Rust-friendly binding for your D-Bus service!
[`pkg-config`]: https://www.freedesktop.org/wiki/Software/pkg-config/
[cob]: blocking.html
[`Stream`]: https://docs.rs/futures/0.3.17/futures/stream/trait.Stream.html
[`Value`]: https://docs.rs/zvariant/latest/zvariant/derive.Value.html
[`OwnedValue`]: https://docs.rs/zvariant/latest/zvariant/derive.OwnedValue.html

[^busctl]: `busctl` is part of [`systemd`](https://www.freedesktop.org/wiki/Software/systemd/).

0 comments on commit 73fc414

Please sign in to comment.