Trait dbus::SignalArgs [] [src]

pub trait SignalArgs: Default {
    const NAME: &'static str;
    const INTERFACE: &'static str;

    fn append(&self, i: &mut IterAppend);
fn get(&mut self, i: &mut Iter) -> Result<(), TypeMismatchError>; fn to_emit_message(&self, path: &Path) -> Message { ... }
fn from_message(m: &Message) -> Option<Self> { ... }
fn match_str(sender: Option<&BusName>, path: Option<&Path>) -> String { ... } }

Helper methods for structs representing a Signal

Example

Listen to InterfacesRemoved signal from org.bluez.obex.

use dbus::{Connection, ConnectionItem, BusType, SignalArgs};
use dbus::stdintf::org_freedesktop_dbus::ObjectManagerInterfacesRemoved as IR;

let c = Connection::get_private(BusType::Session).unwrap();
// Add a match for this signal
let mstr = IR::match_str(Some(&"org.bluez.obex".into()), None);
c.add_match(&mstr).unwrap();

// Wait for the signal to arrive.
for n in c.iter(1000) {
    if let ConnectionItem::Signal(msg) = n {
        if let Some(ir) = IR::from_message(&msg) {
            println!("Interfaces {:?} have been removed from bluez on path {}.", ir.interfaces, ir.object);
        }
    }
}

Associated Constants

D-Bus name of signal

D-Bus name of interface this signal belongs to

Required Methods

Low-level method for appending this struct to a message.

You're more likely to use one of the more high level functions.

Low-level method for getting arguments from a message.

You're more likely to use one of the more high level functions.

Provided Methods

Returns a message that emits the signal.

If the message is a signal of the correct type, return its arguments, otherwise return None.

This does not check sender and path of the message, which is likely relevant to you as well.

Returns a string that can be sent to Connection::add_match.

If sender and/or path is None, matches all senders and/or paths.

Implementors