Message

Struct Message 

Source
pub struct Message {
    pub big_endian: bool,
    pub message_type: MessageType,
    pub flags: u8,
    pub version: u8,
    pub serial: u32,
    pub headers: Vec<HeaderField>,
    pub body: Vec<u8>,
    /* private fields */
}
Expand description

Represents a received message from the message bus

Fields§

§big_endian: bool§message_type: MessageType§flags: u8§version: u8§serial: u32§headers: Vec<HeaderField>§body: Vec<u8>

Implementations§

Source§

impl Message

Source

pub fn add_arg(self, arg: &dyn Marshal) -> Message

Add the given argument to the Message. Accepts anything that implements the Marshal trait, which is most basic types, as well as the general-purpose dbus_serialize::types::Value enum.

Note that these calls can be chained together to add multiple arguments, see the example

§Examples
dbus_bytestream::message::create_method_call("foo", "/bar", "baz", "bloop")
    .add_arg(&1)
    .add_arg(&"string");
Source

pub fn get_header(&self, name: u8) -> Option<&Variant>

Source

pub fn get_header_mut(&mut self, name: u8) -> Option<&mut Variant>

Source

pub fn add_header(self, name: u8, val: Variant) -> Message

Source

pub fn get_body(&self) -> Result<Option<Vec<Value>>, DemarshalError>

Get the sequence of Values from out of a Message. Returns None if the message doesn’t have a body.

Trait Implementations§

Source§

impl Debug for Message

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Message

Source§

fn default() -> Message

Returns the “default value” for a type. Read more
Source§

impl Marshal for Message

Source§

fn dbus_encode(&self, buf: &mut Vec<u8>) -> usize

Encodes itself into buf, and returns the number of bytes written excluding leading padding
Source§

fn get_type(&self) -> String

Returns the D-Bus type signature for this object

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.