Struct gio::DBusMessage

source ·
#[repr(transparent)]
pub struct DBusMessage { /* private fields */ }
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().

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

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

This will always be non-None, but may be an empty string.

Returns

The value.

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

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

Available 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 !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
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

Returns the argument unchanged.

Calls U::from(self).

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

Returns true if the object is an instance of (can be cast to) T.
Returns the type of the object.
Returns the ObjectClass of the object. Read more
Returns the class of the object.
Returns the class of the object in the given type T. Read more
Returns the interface T of the object. Read more
Sets the property property_name of the object to value value. Read more
Sets the property property_name of the object to value value. Read more
Sets multiple properties of the object at once. Read more
Sets multiple properties of the object at once. Read more
Gets the property property_name of the object and cast it to the type V. Read more
Gets the property property_name of the object. Read more
Check if the object has a property property_name of the given type_. Read more
Get the type of the property property_name of this object. Read more
Get the ParamSpec of the property property_name of this object.
Return all ParamSpec of the properties of this object.
Freeze all property notifications until the return guard object is dropped. Read more
Set arbitrary data on this object with the given key. Read more
Return previously set arbitrary data of this object with the given key. Read more
Retrieve previously set arbitrary data of this object with the given key. Read more
Set arbitrary data on this object with the given key. Read more
Return previously set arbitrary data of this object with the given key. Read more
Retrieve previously set arbitrary data of this object with the given key. Read more
Block a given signal handler. Read more
Unblock a given signal handler.
Stop emission of the currently emitted signal.
Stop emission of the currently emitted signal by the (possibly detailed) signal name.
Connect to the signal signal_name on this object. Read more
Connect to the signal signal_id on this object. Read more
Connect to the signal signal_name on this object. Read more
Connect to the signal signal_id on this object. Read more
Connect to the signal signal_name on this object. Read more
Connect to the signal signal_id on this object. Read more
Connect a closure to the signal signal_name on this object. Read more
Connect a closure to the signal signal_id on this object. Read more
Limits the lifetime of closure to the lifetime of the object. When the object’s reference count drops to zero, the closure will be invalidated. An invalidated closure will ignore any calls to invoke_with_values, or invoke when using Rust closures. Read more
Emit signal by signal id. Read more
Same as Self::emit but takes Value for the arguments.
Emit signal by its name. Read more
Emit signal by its name. Read more
Emit signal by its name with details. Read more
Emit signal by its name with details. Read more
Emit signal by signal id with details. Read more
Emit signal by signal id with details. Read more
Disconnect a previously connected signal handler.
Connect to the notify signal of the object. Read more
Connect to the notify signal of the object. Read more
Connect to the notify signal of the object. Read more
Notify that the given property has changed its value. Read more
Notify that the given property has changed its value. Read more
Downgrade this object to a weak reference.
Add a callback to be notified when the Object is disposed.
Add a callback to be notified when the Object is disposed. Read more
Bind property source_property on this object to the target_property on the target object. Read more
Returns the strong reference count of this object.
Runs the dispose mechanism of the object. Read more
Ensures that the type has been registered with the type system.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
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.