Module dbus::arg
[−]
[src]
Types and traits for easily getting a message's arguments, or appening a message with arguments.
Also see the arguments guide (in the examples directory).
A message has read1
, read2
etc, and append1
, append2
etc, which is your
starting point into this module's types.
Append a:
bool, u8, u16, u32, u64, i16, i32, i64, f64
- the corresponding D-Bus basic type
&str
- a D-Bus string. D-Bus strings do not allow null characters, so
if the string contains null characters, it will be cropped
to only include the data before the null character. (Tip: This allows for skipping an
allocation by writing a string literal which ends with a null character.)
&[T] where T: Append
- a D-Bus array. Note: can use an efficient fast-path in case of
T being an FixedArray type.
Array<T, I> where T: Append, I: Iterator<Item=T>
- a D-Bus array, maximum flexibility.
Variant<T> where T: Append
- a D-Bus variant.
(T1, T2) where T1: Append, T2: Append
- tuples are D-Bus structs. Implemented up to 12.
Dict<K, V, I> where K: Append + DictKey, V: Append, I: Iterator<Item=(&K, &V)>
- A D-Bus dict (array of dict entries).
Path
- a D-Bus object path.
Signature
- a D-Bus signature.
OwnedFd
- shares the file descriptor with the remote side.
Get / read a:
bool, u8, u16, u32, u64, i16, i32, i64, f64
- the corresponding D-Bus basic type
&str
, &CStr
- a D-Bus string. D-Bus strings are always UTF-8 and do not contain null characters.
&[T] where T: FixedArray
- a D-Bus array of integers or f64.
Array<T, Iter> where T: Get
- a D-Bus array, maximum flexibility. Implements Iterator so you can easily
collect it into, e g, a Vec
.
Variant<T> where T: Get
- a D-Bus variant. Use this type of Variant if you know the inner type.
Variant<Iter>
- a D-Bus variant. This type of Variant allows you to examine the inner type.
(T1, T2) where T1: Get, T2: Get
- tuples are D-Bus structs. Implemented up to 12.
Dict<K, V, Iter> where K: Get + DictKey, V: Get
- A D-Bus dict (array of dict entries). Implements Iterator so you can easily
collect it into, e g, a HashMap
.
Path
- a D-Bus object path.
Signature
- a D-Bus signature.
OwnedFd
- a file descriptor sent from the remote side.
Structs
Array |
Represents a D-Bus Array. Maximum flexibility (wraps an iterator of items to append). |
Dict |
Append a D-Bus dict type (i e, an array of dict entries). |
Iter |
Helper struct for retrieve one or more arguments from a Message. |
IterAppend |
Helper struct for appending one or more arguments to a Message. |
TypeMismatchError |
Error struct to indicate a D-Bus argument type mismatch. |
Variant |
A simple wrapper to specify a D-Bus variant. |
Enums
ArgType |
Type of Argument |
Traits
Append |
Types that can be appended to a message as arguments implement this trait. |
Arg |
Types that can represent a D-Bus message argument implement this trait. |
DictKey |
Types that can be used as keys in a dict type implement this trait. |
FixedArray |
If a type implements this trait, it means the size and alignment is the same as in D-Bus. This means that you can quickly append and get slices of this type. |
Get |
Types that can be retrieved from a message as arguments implement this trait. |
RefArg |
Object safe version of Arg + Append + Get. |
Functions
cast |
Cast a RefArg as a specific type (shortcut for any + downcast) |
cast_mut |
Cast a RefArg as a specific type (shortcut for any_mut + downcast_mut) |