Module libpulse_binding::context::subscribe
source · Expand description
Daemon introspection event subscription subsystem.
Overview
The application can be notified, asynchronously, whenever the internal layout of the server
changes. The set of facilities and operations for which notifications are generated are
enumerated in Facility
and Operation
.
The application sets the notification mask using Context::subscribe()
and the callback
function that will be called whenever a notification occurs using
Context::set_subscribe_callback()
.
The mask provided to Context::subscribe()
can be created by binary ORing a set of values,
either produced with Facility::to_interest_mask()
, or more simply with the provided
constants in the subscription_masks
submodule.
The callback will be called with event type information representing the event that caused the
callback, detailing facility and operation, where for instance Facility::Source
with
Operation::New
indicates that a new source was added.
Example
Subscribe (declare interest):
use libpulse_binding::context::subscribe::subscription_masks;
let interest = subscription_masks::SINK |
subscription_masks::SOURCE;
let op = my_context.subscribe(
interest, // Our interest mask
|_| {} // We won’t bother doing anything in the success callback in this example
);
Modules
- subscription_masksDeprecatedA set of masks used for expressing which facilities you are interested in when subscribing.
Structs
- A set of facility masks, to be passed to
Context::subscribe()
.
Enums
- Facility component of an event.
- Operation component of an event.
Constants
- FACILITY_MASKDeprecatedMask to extract facility value from the event type passed to the user callback.
- OPERATION_MASKDeprecatedMask to extract operation value from the event type passed to the user callback.
Type Definitions
- The base integer type passed to the callback, from which the facility and operation components can be extracted.