pub struct EventManager<'a> { /* private fields */ }
Expand description

A struct that simplifies the process of adding and removing listeners and callbacks to/from MPRIS DBus signals.

Implementations

Creates a new event manager.

Adds a new callback to the event manager.

Callbacks can be provided either as a closure, or as a function. A callback takes only one parameter, a Message.

Errors

Returns an Err if there is a failure in adding a match rule to the connection.

Example
let mut manager = EventManager::new(&connection);
// Be advised that it is important that this is assigned to a variable
let _incoming = manager
    .add_callback(EventType::PropertiesChanged, |msg| {
        println!("Data: {:?}", msg);
        true
    })
    .await?;

Clears all registered callbacks from the manager.

Errors

Returns an Err if there is a failure in removing a match from the connection.

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

Returns the argument unchanged.

Calls U::from(self).

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

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.