pub struct Message { /* private fields */ }
Expand description

A D-Bus message. A message contains headers - usually destination address, path, interface and member, and a list of arguments.

Implementations

Creates a new method call message.

Creates a new method call message.

Creates a new message that is a replica of this message, but without a serial.

May fail if out of memory or file descriptors.

Creates a new method call message.

Creates a new signal message.

Creates a new signal message.

Creates a method reply for this method call.

Creates a method return (reply) for this method call.

Creates a reply for a method call message.

Panics if called for a message which is not a method call.

Creates a new error reply

Get the MessageItems that make up the message.

Note: use iter_init or get1/get2/etc instead for faster access to the arguments. This method is provided for backwards compatibility.

Get the D-Bus serial of a message, if one was specified.

Get the serial of the message this message is a reply to, if present.

Returns true if the message does not expect a reply.

Set whether or not the message expects a reply.

Set to true if you send a method call and do not want a reply.

Returns true if the message can cause a service to be auto-started.

Sets whether or not the message can cause a service to be auto-started.

Defaults to true.

Add one or more MessageItems to this Message.

Note: using append1, append2 or append3 might be faster, especially for large arrays. This method is provided for backwards compatibility.

Appends one argument to this message. Use in builder style: e g m.method_return().append1(7i32)

Appends two arguments to this message. Use in builder style: e g m.method_return().append2(7i32, 6u8)

Appends three arguments to this message. Use in builder style: e g m.method_return().append3(7i32, 6u8, true)

Appends RefArgs to this message. Use in builder style: e g m.method_return().append_ref(&[7i32, 6u8, true])

Appends arguments to a message.

Gets the first argument from the message, if that argument is of type G1. Returns None if there are not enough arguments, or if types don’t match.

Gets the first two arguments from the message, if those arguments are of type G1 and G2. Returns None if there are not enough arguments, or if types don’t match.

Gets the first three arguments from the message, if those arguments are of type G1, G2 and G3. Returns None if there are not enough arguments, or if types don’t match.

Gets the first four arguments from the message, if those arguments are of type G1, G2, G3 and G4. Returns None if there are not enough arguments, or if types don’t match.

Gets the first five arguments from the message, if those arguments are of type G1, G2, G3 and G4. Returns None if there are not enough arguments, or if types don’t match. Note: If you need more than five arguments, use iter_init instead.

Gets the first argument from the message, if that argument is of type G1.

Returns a TypeMismatchError if there are not enough arguments, or if types don’t match.

Gets the first two arguments from the message, if those arguments are of type G1 and G2.

Returns a TypeMismatchError if there are not enough arguments, or if types don’t match.

Gets the first three arguments from the message, if those arguments are of type G1, G2 and G3.

Returns a TypeMismatchError if there are not enough arguments, or if types don’t match.

Gets the first four arguments from the message, if those arguments are of type G1, G2, G3 and G4.

Returns a TypeMismatchError if there are not enough arguments, or if types don’t match.

Gets the first five arguments from the message, if those arguments are of type G1, G2, G3, G4 and G5.

Returns a TypeMismatchError if there are not enough arguments, or if types don’t match. Note: If you need more than five arguments, use iter_init instead.

Gets arguments from a message.

If this was an error reply or if types mismatch, an error is returned.

Returns a struct for retreiving the arguments from a message. Supersedes get_items().

Gets the MessageType of the Message.

Gets the name of the connection that originated this message.

Gets the object path this Message is being sent to.

Gets the destination this Message is being sent to.

Sets the destination of this Message

If dest is none, that means broadcast to all relevant destinations.

Gets the interface this Message is being sent to.

Gets the interface member being called.

When the remote end returns an error, the message itself is correct but its contents is an error. This method will transform such an error to a D-Bus Error or otherwise return the original message.

Sets serial number manually - mostly for internal use

When sending a message, a serial will be automatically assigned, so you don’t need to call this method. However, it can be very useful in test code that is supposed to handle a method call. This way, you can create a method call and handle it without sending it to a real D-Bus instance.

Marshals a message - mostly for internal use

The function f will be called one or more times with bytes to be written somewhere. You should call set_serial to manually set a serial number before calling this function

Demarshals a message - mostly for internal use

Returns the size of the message - mostly for internal use

Returns Err(()) on protocol errors. Make sure you have at least 16 bytes in the buffer before calling this method.

Trait Implementations

Formats the value using the given formatter. Read more
Executes the destructor for this type. Read more
Converts to this type from the input type.

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 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.