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

    fn to_emit_message(&self, path: &Path<'_>) -> Message
    where
        Self: AppendAll
, { ... } fn from_message(m: &Message) -> Option<Self>
    where
        Self: Sized + ReadAll
, { ... } fn match_rule<'a>(
        sender: Option<&'a BusName<'_>>,
        path: Option<&'a Path<'_>>
    ) -> MatchRule<'a> { ... } fn match_str(sender: Option<&BusName<'_>>, path: Option<&Path<'_>>) -> String { ... } }
Expand description

Helper methods for structs representing a Signal

Example

Listen to InterfacesRemoved signal from org.bluez.obex.

use dbus::blocking::Connection;
use dbus::message::SignalArgs;
use dbus::blocking::stdintf::org_freedesktop_dbus::ObjectManagerInterfacesRemoved as IR;
use std::time::Duration;

let c = Connection::new_session().unwrap();
// Add a match for this signal
let mr = IR::match_rule(Some(&"org.bluez.obex".into()), None).static_clone();
c.add_match(mr, |ir: IR, _, _| {
     println!("Interfaces {:?} have been removed from bluez on path {}.", ir.interfaces, ir.object);
     true
});

// Wait for the signal to arrive.
loop { c.process(Duration::from_millis(1000)).unwrap(); }

Required Associated Constants

D-Bus name of signal

D-Bus name of interface this signal belongs to

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 match rule matching this signal.

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

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