pub trait DebugControllerDBusExt: 'static {
    // Required methods
    fn stop(&self);
    fn connect_authorize<F: Fn(&Self, &DBusMethodInvocation) -> bool + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
}
Available on crate feature v2_72 only.
Expand description

Required Methods§

source

fn stop(&self)

Stop the debug controller, unregistering its object from the bus.

Any pending method calls to the object will complete successfully, but new ones will return an error. This method will block until all pending authorize signals have been handled. This is expected to not take long, as it will just be waiting for threads to join. If any authorize signal handlers are still executing in other threads, this will block until after they have returned.

This method will be called automatically when the final reference to the DebugControllerDBus is dropped. You may want to call it explicitly to know when the controller has been fully removed from the bus, or to break reference count cycles.

Calling this method from within a authorize signal handler will cause a deadlock and must not be done.

source

fn connect_authorize<F: Fn(&Self, &DBusMethodInvocation) -> bool + 'static>( &self, f: F ) -> SignalHandlerId

Emitted when a D-Bus peer is trying to change the debug settings and used to determine if that is authorized.

This signal is emitted in a dedicated worker thread, so handlers are allowed to perform blocking I/O. This means that, for example, it is appropriate to call polkit_authority_check_authorization_sync() to check authorization using polkit.

If false is returned then no further handlers are run and the request to change the debug settings is rejected.

Otherwise, if true is returned, signal emission continues. If no handlers return false, then the debug settings are allowed to be changed.

Signal handlers must not modify invocation, or cause it to return a value.

The default class handler just returns true.

invocation

A DBusMethodInvocation.

Returns

true if the call is authorized, false otherwise.

Implementors§