[][src]Struct dbus_message_parser::Message

pub struct Message { /* fields omitted */ }

This represents a DBus message.

Methods

impl Message[src]

pub fn decode(
    buf: &BytesMut,
    offset: &mut usize
) -> Result<Message, DecodeError>
[src]

Decode a byte array to a Message object.

Example

let msg = b"l\x02\x01\x01\n\0\0\0\x01\0\0\0=\0\0\0\x06\x01s\0\x05\0\0\0:1.98\0\0\0\x05\x01u\0\x01\0\0\0\x08\x01g\0\x01s\0\0\x07\x01s\0\x14\0\0\0org.freedesktop.DBus\0\0\0\0\x05\0\0\0:1.98\0";
let buf_read = BytesMut::from(&msg[..]);
let mut offset: usize = 0;

if let Ok(msg) = Message::decode(&buf_read, &mut offset) {
    //...
}

pub fn encode(&self, buf: &mut BytesMut) -> Result<(), EncodeError>[src]

Encode a Message object to a byte array.

pub fn method_call(
    destination: &str,
    path: &str,
    interface: &str,
    member: &str
) -> Message
[src]

Create a Message object as a MethodCall.

pub fn signal(path: &str, interface: &str, member: &str) -> Message[src]

Create a Message object as a Signal.

pub fn get_serial(&self) -> u32[src]

Get the serial number.

pub fn set_serial(&mut self, serial: u32)[src]

Set the serial number.

pub fn get_reply_serial(&self) -> Option<u32>[src]

Get the ReplySerial number, if there is one in the header field.

pub fn get_path(&self) -> Option<&String>[src]

Get the Path, if there is one in the header field.

pub fn has_interface(&self) -> bool[src]

It is true if the message contains an Interface in the header fields.

pub fn get_interface(&self) -> Option<&String>[src]

Get the Path, if there is one in the header field.

pub fn has_member(&self) -> bool[src]

It is true if the message contains an Member in the header fields.

pub fn get_member(&self) -> Option<&String>[src]

Get the Member, if there is one in the header field.

pub fn has_error_name(&self) -> bool[src]

It is true if the message contains an ErrorName in the header fields.

pub fn get_error_name(&self) -> Option<&String>[src]

Get the ErrorName, if there is one in the header field.

pub fn get_sender(&self) -> Option<&String>[src]

Get the Sender, if there is one in the header field.

pub fn get_destination(&self) -> Option<&String>[src]

Get the Destination, if there is one in the header field.

pub fn has_signature(&self) -> bool[src]

It is true if the message contains an Signature in the header fields.

pub fn get_signature(&self) -> Option<&String>[src]

Get the Signature, if there is one in the header field.

pub fn add_value(&mut self, value: Value)[src]

Add a new value to the body.

pub fn method_return(&self) -> Result<Message, ()>[src]

Create a message return from this Message. Only works if this Message is a MethodCall.

pub fn unknown_path(&self) -> Result<Message, ()>[src]

Create a unknown path error message from this Message.

pub fn unknown_interface(&self) -> Result<Message, ()>[src]

Create a unknown interface error message from this Message.

pub fn unknown_method(&self) -> Result<Message, ()>[src]

Create a unknown method error message from this Message.

pub fn invalid_args(&self, reason: &str) -> Result<Message, ()>[src]

Create an invalid args error message from this Message.

pub fn error(&self, name: String, message: String) -> Result<Message, ()>[src]

Create an error message from this Message.

pub fn get_body(&self) -> &Vec<Value>[src]

Get the body.

pub fn get_type(&self) -> MessageType[src]

Get the message type.

pub fn split(self) -> (MessageHeader, Vec<Value>)[src]

Split the Message object into the header and the body.

Trait Implementations

impl Clone for Message[src]

impl Debug for Message[src]

Auto Trait Implementations

impl RefUnwindSafe for Message

impl Send for Message

impl Sync for Message

impl Unpin for Message

impl UnwindSafe for Message

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.