Module 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
);

Structs§

InterestMaskSet
A set of facility masks, to be passed to Context::subscribe().

Enums§

Facility
Facility component of an event.
Operation
Operation component of an event.

Type Aliases§

EventType
The base integer type passed to the callback, from which the facility and operation components can be extracted.