pub enum MessageItem {
Show 17 variants Array(MessageItemArray), Struct(Vec<MessageItem>), Variant(Box<MessageItem>), Dict(MessageItemDict), ObjectPath(Path<'static>), Signature(Signature<'static>), Str(String), Bool(bool), Byte(u8), Int16(i16), Int32(i32), Int64(i64), UInt16(u16), UInt32(u32), UInt64(u64), Double(f64), UnixFd(OwnedFd),
}
Expand description

MessageItem - used as parameters and return values from method calls, or as data added to a signal (old, enum version).

Note that the newer generic design (see arg module) is both faster and less error prone than MessageItem, and should be your first hand choice whenever applicable.

Variants

Array(MessageItemArray)

A D-Bus array requires all elements to be of the same type. All elements must match the Signature.

Struct(Vec<MessageItem>)

A D-Bus struct allows for values of different types.

Variant(Box<MessageItem>)

A D-Bus variant is a wrapper around another MessageItem, which can be of any type.

Dict(MessageItemDict)

A D-Bus dictionary. All keys and values are required to be of the same type. Not all types can be dictionary keys, but all can be dictionary values.

ObjectPath(Path<'static>)

A D-Bus objectpath requires its content to be a valid objectpath, so this cannot be any string.

Signature(Signature<'static>)

A D-Bus signature requires its content to be a valid type signature, so this cannot be any string.

Str(String)

A D-Bus String is zero terminated, so no \0 s in the String, please. (D-Bus strings are also - like Rust strings - required to be valid UTF-8.)

Bool(bool)

A D-Bus boolean type.

Byte(u8)

A D-Bus unsigned 8 bit type.

Int16(i16)

A D-Bus signed 16 bit type.

Int32(i32)

A D-Bus signed 32 bit type.

Int64(i64)

A D-Bus signed 64 bit type.

UInt16(u16)

A D-Bus unsigned 16 bit type.

UInt32(u32)

A D-Bus unsigned 32 bit type.

UInt64(u64)

A D-Bus unsigned 64 bit type.

Double(f64)

A D-Bus IEEE-754 double-precision floating point type.

UnixFd(OwnedFd)

D-Bus allows for sending file descriptors, which can be used to set up SHM, unix pipes, or other communication channels.

Implementations

Get the D-Bus Signature for this MessageItem.

Get the arg type of this MessageItem.

Creates a (String, Variant) dictionary from an iterator with Result passthrough (an Err will abort and return that Err)

Creates an MessageItem::Array from a list of MessageItems.

Note: This requires v to be non-empty. See also MessageItem::from(&[T]), which can handle empty arrays as well.

Creates an MessageItem::Dict from a list of MessageItem pairs.

Note: This requires v to be non-empty. See also MessageItem::from(&[(T1, T2)]), which can handle empty arrays as well.

Get the inner value of a MessageItem

Example
use dbus::arg::messageitem::MessageItem;
let m: MessageItem = 5i64.into();
let s: i64 = m.inner().unwrap();
assert_eq!(s, 5i64);

Get the underlying MessageItem of a MessageItem::Variant

Nested MessageItem::Variants are unwrapped recursively until a non-Variant is found.

Example
use dbus::arg::messageitem::MessageItem;
let nested = MessageItem::Variant(Box::new(6i64.into()));
let flat: MessageItem = 6i64.into();
assert_ne!(&nested, &flat);
assert_eq!(nested.peel(), &flat);

Trait Implementations

Performs the append operation by borrowing self.
Performs the append operation by consuming self.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Create a MessageItem::Dict.

Converts to this type from the input type.

Create a MessageItem::Array.

Converts to this type from the input type.
Converts to this type from the input type.

Create a MessageItem::Variant

Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Performs the get operation.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
The corresponding D-Bus argument type code.
The corresponding D-Bus type signature for this type.
Performs the append operation.
Transforms this argument to Any (which can be downcasted to read the current value). Read more
Transforms this argument to Any (which can be downcasted to read the current value). Read more
Deep clone of the RefArg, causing the result to be ’static. Read more
Try to read the argument as an i64. Read more
Try to read the argument as an u64. Read more
Try to read the argument as an f64. Read more
Try to read the argument as a str. Read more
Try to read the argument as an iterator. Read more
Try to read the inner of an argument, as another argument, specifying an index. Read more
Deep clone of an array. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.