Struct gio::DBusMessage[][src]

pub struct DBusMessage(_);
Expand description

A type for representing D-Bus messages that can be sent or received on a DBusConnection.

Implements

glib::ObjectExt

Implementations

Creates a new empty DBusMessage.

Returns

A DBusMessage. Free with g_object_unref().

Creates a new DBusMessage from the data stored at blob. The byte order that the message was in can be retrieved using byte_order().

If the blob cannot be parsed, contains invalid fields, or contains invalid headers, IOErrorEnum::InvalidArgument will be returned.

blob

A blob representing a binary D-Bus message.

capabilities

A DBusCapabilityFlags describing what protocol features are supported.

Returns

A new DBusMessage or None if error is set. Free with g_object_unref().

Creates a new DBusMessage for a method call.

name

A valid D-Bus name or None.

path

A valid object path.

interface_

A valid D-Bus interface name or None.

method

A valid method name.

Returns

A DBusMessage. Free with g_object_unref().

Creates a new DBusMessage for a signal emission.

path

A valid object path.

interface_

A valid D-Bus interface name.

signal

A valid signal name.

Returns

A DBusMessage. Free with g_object_unref().

Copies self. The copy is a deep copy and the returned DBusMessage is completely identical except that it is guaranteed to not be locked.

This operation can fail if e.g. self contains file descriptors and the per-process or system-wide open files limit is reached.

Returns

A new DBusMessage or None if error is set. Free with g_object_unref().

Convenience to get the first item in the body of self.

Returns

The string item or None if the first item in the body of self is not a string.

Gets the body of a message.

Returns

A glib::Variant or None if the body is empty. Do not free, it is owned by self.

Gets the byte order of self.

Returns

The byte order.

Convenience getter for the DBusMessageHeaderField::Destination header field.

Returns

The value.

Convenience getter for the DBusMessageHeaderField::ErrorName header field.

Returns

The value.

Gets the flags for self.

Returns

Flags that are set (typically values from the DBusMessageFlags enumeration bitwise ORed together).

Gets a header field on self.

The caller is responsible for checking the type of the returned glib::Variant matches what is expected.

header_field

A 8-bit unsigned integer (typically a value from the DBusMessageHeaderField enumeration)

Returns

A glib::Variant with the value if the header was found, None otherwise. Do not free, it is owned by self.

Convenience getter for the DBusMessageHeaderField::Interface header field.

Returns

The value.

Checks whether self is locked. To monitor changes to this value, conncet to the signal::glib::Object::notify signal to listen for changes on the property::DBusMessage::locked property.

Returns

true if self is locked, false otherwise.

Convenience getter for the DBusMessageHeaderField::Member header field.

Returns

The value.

Gets the type of self.

Returns

A 8-bit unsigned integer (typically a value from the DBusMessageType enumeration).

This is supported on Unix only.

Convenience getter for the DBusMessageHeaderField::NumUnixFds header field.

Returns

The value.

Convenience getter for the DBusMessageHeaderField::Path header field.

Returns

The value.

Convenience getter for the DBusMessageHeaderField::ReplySerial header field.

Returns

The value.

Convenience getter for the DBusMessageHeaderField::Sender header field.

Returns

The value.

Gets the serial for self.

Returns

A guint32.

Convenience getter for the DBusMessageHeaderField::Signature header field.

Returns

The value.

This is supported on Unix only.

Gets the UNIX file descriptors associated with self, if any.

This method is only available on UNIX.

The file descriptors normally correspond to G_VARIANT_TYPE_HANDLE values in the body of the message. For example, if [glib::Variant::handle()][crate::glib::Variant::handle()] returns 5, that is intended to be a reference to the file descriptor that can be accessed by g_unix_fd_list_get (list, 5, ...).

Returns

A UnixFDList or None if no file descriptors are associated. Do not free, this object is owned by self.

If self is locked, does nothing. Otherwise locks the message.

Creates a new DBusMessage that is an error reply to self.

error_name

A valid D-Bus error name.

error_message

The D-Bus error message.

Returns

A DBusMessage. Free with g_object_unref().

Creates a new DBusMessage that is a reply to self.

Returns

DBusMessage. Free with g_object_unref().

Produces a human-readable multi-line description of self.

The contents of the description has no ABI guarantees, the contents and formatting is subject to change at any time. Typical output looks something like this:

Flags:   none
Version: 0
Serial:  4
Headers:
  path -> objectpath '/org/gtk/GDBus/TestObject'
  interface -> 'org.gtk.GDBus.TestInterface'
  member -> 'GimmeStdout'
  destination -> ':1.146'
Body: ()
UNIX File Descriptors:
  (none)

or

Flags:   no-reply-expected
Version: 0
Serial:  477
Headers:
  reply-serial -> uint32 4
  destination -> ':1.159'
  sender -> ':1.146'
  num-unix-fds -> uint32 1
Body: ()
UNIX File Descriptors:
  fd 12: dev=0:10,mode=020620,ino=5,uid=500,gid=5,rdev=136:2,size=0,atime=1273085037,mtime=1273085851,ctime=1272982635

indent

Indentation level.

Returns

A string that should be freed with g_free().

Sets the body self. As a side-effect the DBusMessageHeaderField::Signature header field is set to the type string of body (or cleared if body is None).

If body is floating, self assumes ownership of body.

body

Either None or a glib::Variant that is a tuple.

Sets the byte order of self.

byte_order

The byte order.

Convenience setter for the DBusMessageHeaderField::Destination header field.

value

The value to set.

Convenience setter for the DBusMessageHeaderField::ErrorName header field.

value

The value to set.

Sets the flags to set on self.

flags

Flags for self that are set (typically values from the DBusMessageFlags enumeration bitwise ORed together).

Sets a header field on self.

If value is floating, self assumes ownership of value.

header_field

A 8-bit unsigned integer (typically a value from the DBusMessageHeaderField enumeration)

value

A glib::Variant to set the header field or None to clear the header field.

Convenience setter for the DBusMessageHeaderField::Interface header field.

value

The value to set.

Convenience setter for the DBusMessageHeaderField::Member header field.

value

The value to set.

Sets self to be of type_.

type_

A 8-bit unsigned integer (typically a value from the DBusMessageType enumeration).

This is supported on Unix only.

Convenience setter for the DBusMessageHeaderField::NumUnixFds header field.

value

The value to set.

Convenience setter for the DBusMessageHeaderField::Path header field.

value

The value to set.

Convenience setter for the DBusMessageHeaderField::ReplySerial header field.

value

The value to set.

Convenience setter for the DBusMessageHeaderField::Sender header field.

value

The value to set.

Sets the serial for self.

serial

A guint32.

Convenience setter for the DBusMessageHeaderField::Signature header field.

value

The value to set.

This is supported on Unix only.

Sets the UNIX file descriptors associated with self. As a side-effect the DBusMessageHeaderField::NumUnixFds header field is set to the number of fds in fd_list (or cleared if fd_list is None).

This method is only available on UNIX.

When designing D-Bus APIs that are intended to be interoperable, please note that non-GDBus implementations of D-Bus can usually only access file descriptors if they are referenced by a value of type G_VARIANT_TYPE_HANDLE in the body of the message.

fd_list

A UnixFDList or None.

Serializes self to a blob. The byte order returned by byte_order() will be used.

capabilities

A DBusCapabilityFlags describing what protocol features are supported.

Returns

A pointer to a valid binary D-Bus message of out_size bytes generated by self or None if error is set. Free with g_free().

If self is not of type DBusMessageType::Error does nothing and returns false.

Otherwise this method encodes the error in self as a glib::Error using g_dbus_error_set_dbus_error() using the information in the DBusMessageHeaderField::ErrorName header field of self as well as the first string item in self’s body.

Returns

true if error was set, false otherwise.

Utility function to calculate how many bytes are needed to completely deserialize the D-Bus message stored at blob.

blob

A blob representing a binary D-Bus message.

Returns

Number of bytes needed or -1 if error is set (e.g. if blob contains invalid data or not enough data is available to determine the size).

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Returns the type identifier of Self.

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

Upcasts an object to a superclass or interface T. Read more

Upcasts an object to a reference of its superclass or interface T. Read more

Tries to downcast to a subclass or interface implementor T. Read more

Tries to downcast to a reference of its subclass or interface implementor T. Read more

Tries to cast to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more

Tries to cast to reference to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more

Casts to T unconditionally. Read more

Casts to &T unconditionally. Read more

Performs the conversion.

Performs the conversion.

Returns true if the object is an instance of (can be cast to) T.

Safety Read more

Safety Read more

Safety Read more

Safety Read more

Safety Read more

Safety Read more

Same as connect but takes a SignalId instead of a signal name.

Same as connect_local but takes a SignalId instead of a signal name.

Same as connect_unsafe but takes a SignalId instead of a signal name.

Emit signal by signal id.

Emit signal with details by signal id.

Emit signal by it’s name.

Same as emit but takes Value for the arguments.

Same as emit_by_name but takes Value for the arguments.

Same as emit_with_details but takes Value for the arguments.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

Returns a SendValue clone of self.

Converts the given value to a String. Read more

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.