[]Struct gio::DBusMessage

pub struct DBusMessage(_, _);

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

Implements

glib::object::ObjectExt

Implementations

impl DBusMessage[src]

pub fn new() -> DBusMessage[src]

Creates a new empty DBusMessage.

Returns

A DBusMessage. Free with gobject::ObjectExt::unref.

pub fn from_blob(
    blob: &[u8],
    capabilities: DBusCapabilityFlags
) -> Result<DBusMessage, Error>
[src]

pub fn new_method_call(
    name: Option<&str>,
    path: &str,
    interface_: Option<&str>,
    method: &str
) -> DBusMessage
[src]

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 gobject::ObjectExt::unref.

pub fn new_signal(path: &str, interface_: &str, signal: &str) -> DBusMessage[src]

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 gobject::ObjectExt::unref.

pub fn copy(&self) -> Result<DBusMessage, Error>[src]

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 gobject::ObjectExt::unref.

pub fn get_arg0(&self) -> Option<GString>[src]

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.

pub fn get_body(&self) -> Option<Variant>[src]

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.

pub fn get_byte_order(&self) -> DBusMessageByteOrder[src]

Gets the byte order of self.

Returns

The byte order.

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

Convenience getter for the DBusMessageHeaderField::Destination header field.

Returns

The value.

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

Convenience getter for the DBusMessageHeaderField::ErrorName header field.

Returns

The value.

pub fn get_flags(&self) -> DBusMessageFlags[src]

Gets the flags for self.

Returns

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

pub fn get_header(
    &self,
    header_field: DBusMessageHeaderField
) -> Option<Variant>
[src]

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.

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

Convenience getter for the DBusMessageHeaderField::Interface header field.

Returns

The value.

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

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

Returns

true if self is locked, false otherwise.

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

Convenience getter for the DBusMessageHeaderField::Member header field.

Returns

The value.

pub fn get_message_type(&self) -> DBusMessageType[src]

Gets the type of self.

Returns

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

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

Convenience getter for the DBusMessageHeaderField::NumUnixFds header field.

Returns

The value.

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

Convenience getter for the DBusMessageHeaderField::Path header field.

Returns

The value.

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

Convenience getter for the DBusMessageHeaderField::ReplySerial header field.

Returns

The value.

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

Convenience getter for the DBusMessageHeaderField::Sender header field.

Returns

The value.

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

Gets the serial for self.

Returns

A guint32.

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

Convenience getter for the DBusMessageHeaderField::Signature header field.

Returns

The value.

pub fn get_unix_fd_list(&self) -> Option<UnixFDList>[src]

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

This method is only available on UNIX.

Returns

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

pub fn lock(&self)[src]

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

pub fn new_method_error_literal(
    &self,
    error_name: &str,
    error_message: &str
) -> Option<DBusMessage>
[src]

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 gobject::ObjectExt::unref.

pub fn new_method_reply(&self) -> Option<DBusMessage>[src]

Creates a new DBusMessage that is a reply to self.

Returns

DBusMessage. Free with gobject::ObjectExt::unref.

pub fn print(&self, indent: u32) -> Option<GString>[src]

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.

pub fn set_body(&self, body: &Variant)[src]

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.

pub fn set_byte_order(&self, byte_order: DBusMessageByteOrder)[src]

Sets the byte order of self.

byte_order

The byte order.

pub fn set_destination(&self, value: &str)[src]

Convenience setter for the DBusMessageHeaderField::Destination header field.

value

The value to set.

pub fn set_error_name(&self, value: &str)[src]

Convenience setter for the DBusMessageHeaderField::ErrorName header field.

value

The value to set.

pub fn set_flags(&self, flags: DBusMessageFlags)[src]

Sets the flags to set on self.

flags

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

pub fn set_header(
    &self,
    header_field: DBusMessageHeaderField,
    value: Option<&Variant>
)
[src]

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.

pub fn set_interface(&self, value: &str)[src]

Convenience setter for the DBusMessageHeaderField::Interface header field.

value

The value to set.

pub fn set_member(&self, value: &str)[src]

Convenience setter for the DBusMessageHeaderField::Member header field.

value

The value to set.

pub fn set_message_type(&self, type_: DBusMessageType)[src]

Sets self to be of type_.

type_

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

pub fn set_num_unix_fds(&self, value: u32)[src]

Convenience setter for the DBusMessageHeaderField::NumUnixFds header field.

value

The value to set.

pub fn set_path(&self, value: &str)[src]

Convenience setter for the DBusMessageHeaderField::Path header field.

value

The value to set.

pub fn set_reply_serial(&self, value: u32)[src]

Convenience setter for the DBusMessageHeaderField::ReplySerial header field.

value

The value to set.

pub fn set_sender(&self, value: &str)[src]

Convenience setter for the DBusMessageHeaderField::Sender header field.

value

The value to set.

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

Sets the serial for self.

serial

A guint32.

pub fn set_signature(&self, value: &str)[src]

Convenience setter for the DBusMessageHeaderField::Signature header field.

value

The value to set.

pub fn set_unix_fd_list<P: IsA<UnixFDList>>(&self, fd_list: Option<&P>)[src]

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.

fd_list

A UnixFDList or None.

pub fn to_blob(
    &self,
    capabilities: DBusCapabilityFlags
) -> Result<Vec<u8>, Error>
[src]

Serializes self to a blob. The byte order returned by DBusMessage::get_byte_order will be used.

out_size

Return location for size of generated blob.

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.

pub fn to_gerror(&self) -> Result<(), Error>[src]

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

pub fn bytes_needed(blob: &[u8]) -> Result<isize, Error>[src]

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.

blob_len

The length of blob (must be at least 16).

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

pub fn connect_property_locked_notify<F: Fn(&DBusMessage) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

Trait Implementations

impl Clone for DBusMessage

impl Debug for DBusMessage

impl Default for DBusMessage[src]

impl Display for DBusMessage[src]

impl Eq for DBusMessage

impl Hash for DBusMessage

impl Ord for DBusMessage

impl<T: ObjectType> PartialEq<T> for DBusMessage

impl<T: ObjectType> PartialOrd<T> for DBusMessage

impl StaticType for DBusMessage

Auto Trait Implementations

impl RefUnwindSafe for DBusMessage

impl !Send for DBusMessage

impl !Sync for DBusMessage

impl Unpin for DBusMessage

impl UnwindSafe for DBusMessage

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<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 

impl<T> Cast for T where
    T: ObjectType, 

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType, 

impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<Array>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToSendValue for T where
    T: ToValue + SetValue + Send + ?Sized

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized

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.