pub async fn register_power_signal_handler<F, R>(
    bus: &SyncConnection,
    cb: F
) -> Result<Vec<MsgMatch>, Box<dyn Error>>where
    F: FnOnce(PowerState, bool) -> R + Send + Copy + Sync + 'static,
    R: Future<Output = ()> + Send,
Expand description

Register a callback cb to called on host power state transitions.

cb will be called with the attribute of power state that changed (again kind of a hack datatype-wise, see DBusPowerStateProperty::power_state) and the new state of that attribute (true for on, false for off).