Skip to main content

Message

Struct Message 

Source
pub struct Message {
    pub message_type: MessageType,
    pub flags: u8,
    pub serial: u32,
    pub path: Option<String>,
    pub interface: Option<String>,
    pub member: Option<String>,
    pub error_name: Option<String>,
    pub reply_serial: Option<u32>,
    pub destination: Option<String>,
    pub sender: Option<String>,
    pub body: Vec<Value>,
    pub unix_fds: u32,
}
Expand description

One D-Bus message.

Fields§

§message_type: MessageType§flags: u8§serial: u32§path: Option<String>§interface: Option<String>§member: Option<String>§error_name: Option<String>§reply_serial: Option<u32>§destination: Option<String>§sender: Option<String>§body: Vec<Value>§unix_fds: u32

How many file descriptors travelled beside this message.

A h value in the body is an index into them, not a descriptor, and they arrive out of band — see super::fds. Declared here so the transport knows how many to claim for this message and no more.

Implementations§

Source§

impl Message

Source

pub fn call( destination: &str, path: &str, interface: &str, member: &str, ) -> Self

A method call.

Source

pub fn signal(path: &str, interface: &str, member: &str) -> Self

A signal.

Source

pub fn reply_to(call: &Message) -> Self

A successful reply to call.

Source

pub fn error_to(call: &Message, name: &str, text: &str) -> Self

An error reply to call.

Source

pub fn with_body(self, body: Vec<Value>) -> Self

Attach a body.

Source

pub fn signature(&self) -> String

The body’s signature, derived from the values themselves.

Source

pub fn arg(&self, i: usize) -> Option<&Value>

body[i], if present.

Source

pub fn error_text(&self) -> Option<String>

The text of an error reply.

Source

pub fn serialize(&self, serial: u32) -> Vec<u8> ⓘ

Encode to the wire.

Source

pub fn framed_length(buf: &[u8]) -> Option<usize>

How long a message starting at buf is, or None if the fixed header has not arrived yet. Used to know how much more to read.

Source

pub fn parse(buf: &[u8]) -> Result<Self, CodecError>

Decode one complete message.

Trait Implementations§

Source§

impl Clone for Message

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Message

Source§

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

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.