[][src]Module libpulse_binding::context::subscribe

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::Context::subscribe and the callback function that will be called whenever a notification occurs using ::context::Context::set_subscribe_callback.

The mask provided to ::context::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):

This example is not tested
use pulse::context::subscribe::subscription_masks;

let interest = subscription_masks::SINK |
    subscription_masks::SOURCE;

let op = my_context.subscribe(
    interest,   // Our interest mask
    None        // We won’t bother with a success callback in this example
);

Modules

subscription_masks

A set of masks used for expressing which facilities you are interested in when subscribing.

Enums

Facility

Facility component of an event.

Operation

Operation component of an event.

Constants

FACILITY_MASK

Mask to extract facility value from the event type passed to the user callback.

OPERATION_MASK

Mask to extract operation value from the event type passed to the user callback.

Type Definitions

EventType

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

InterestMaskSet

A set of facility masks, passed to Context::subscribe. Convert a Facility to a mask with facility_to_mask.