Enum dbus::arg::messageitem::MessageItem[][src]

pub enum MessageItem {
    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),
}

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

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.

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

impl MessageItem[src]

pub fn signature(&self) -> Signature<'static>[src]

Get the D-Bus Signature for this MessageItem.

pub fn arg_type(&self) -> ArgType[src]

Get the arg type of this MessageItem.

pub fn from_dict<E, I: Iterator<Item = Result<(String, MessageItem), E>>>(
    i: I
) -> Result<MessageItem, E>
[src]

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

pub fn new_array(v: Vec<MessageItem>) -> Result<MessageItem, ArrayError>[src]

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.

pub fn new_dict(
    v: Vec<(MessageItem, MessageItem)>
) -> Result<MessageItem, ArrayError>
[src]

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.

pub fn inner<'a, T: TryFrom<&'a MessageItem>>(&'a self) -> Result<T, T::Error>[src]

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);

pub fn peel(&self) -> &Self[src]

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

impl Append for MessageItem[src]

impl Clone for MessageItem[src]

impl Debug for MessageItem[src]

impl<'a, T1, T2> From<&'a [(T1, T2)]> for MessageItem where
    T1: Into<MessageItem> + Clone + Default,
    T2: Into<MessageItem> + Clone + Default
[src]

Create a MessageItem::Dict.

impl<'a, T> From<&'a [T]> for MessageItem where
    T: Into<MessageItem> + Clone + Default
[src]

Create a MessageItem::Array.

impl<'a> From<&'a str> for MessageItem[src]

impl From<Box<MessageItem, Global>> for MessageItem[src]

Create a MessageItem::Variant

impl From<OwnedFd> for MessageItem[src]

impl From<Path<'static>> for MessageItem[src]

impl From<Signature<'static>> for MessageItem[src]

impl From<String> for MessageItem[src]

impl From<bool> for MessageItem[src]

impl From<f64> for MessageItem[src]

impl From<i16> for MessageItem[src]

impl From<i32> for MessageItem[src]

impl From<i64> for MessageItem[src]

impl From<u16> for MessageItem[src]

impl From<u32> for MessageItem[src]

impl From<u64> for MessageItem[src]

impl From<u8> for MessageItem[src]

impl<'a> Get<'a> for MessageItem[src]

impl PartialEq<MessageItem> for MessageItem[src]

impl PartialOrd<MessageItem> for MessageItem[src]

impl RefArg for MessageItem[src]

impl StructuralPartialEq for MessageItem[src]

impl<'a> TryFrom<&'a MessageItem> for &'a str[src]

type Error = ()

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a MessageItem> for &'a Path<'static>[src]

type Error = ()

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a MessageItem> for &'a Signature<'static>[src]

type Error = ()

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a MessageItem> for &'a [MessageItem][src]

type Error = ()

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a MessageItem> for &'a OwnedFd[src]

type Error = ()

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a MessageItem> for &'a [(MessageItem, MessageItem)][src]

type Error = ()

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.