#[repr(C)]pub struct PrismConfig {
pub version: u8,
pub registry: *mut PrismRegistry,
pub availability_callback: PrismAvailabilityCallback,
pub availability_userdata: *mut c_void,
pub availability_poll_interval_ms: u32,
pub availability_debounce_samples: u32,
pub availability_backoff_max_ms: u32,
pub availability_auto_power_manage: bool,
pub availability_baseline_callback: PrismAvailabilityBaselineCallback,
}Expand description
A struct containing configuration parameters for Prism or it’s back-ends to use.
Fields§
§version: u8The version of this structure. This field MUST NOT be modified.
registry: *mut PrismRegistryThe registry the created context will be bound to. This MAY be NULL, in which case the context uses the global registry. If non-null, it MUST be a registry obtained from prism_registry_freeze. This field was added in version 3 of this structure.
availability_callback: PrismAvailabilityCallbackA function invoked when a backend’s runtime availability changes, or NULL. When this field is NULL, the context performs no background availability polling and creates no poll thread. When it is non-null, the context runs an internal thread that samples backend availability and invokes this callback on each confirmed transition. The behavior of this callback and the polling model are described in the chapter on background availability enumeration. This field was added in version 3 of this structure.
availability_userdata: *mut c_voidAn opaque pointer passed unmodified to availability_callback on each invocation. Prism does not interpret or take ownership of this value. It is ignored when availability_callback is NULL. This field was added in version 3 of this structure.
availability_poll_interval_ms: u32The base interval, in milliseconds, between availability scans. A value of 0 selects the default of 1000 milliseconds. It is ignored when availability_callback is NULL. This field was added in version 3 of this structure.
availability_debounce_samples: u32The number of consecutive agreeing samples required before a change in a backend’s availability is confirmed and reported. A value of 0 selects the default of 2. A value of 1 confirms every observed change immediately, without debouncing. It is ignored when availability_callback is NULL. This field was added in version 3 of this structure.
availability_backoff_max_ms: u32The upper bound, in milliseconds, for adaptive backoff of the sampling interval. While availability is unchanging, the interval doubles from availability_poll_interval_ms toward this bound, and returns to the base interval as soon as any change is observed. A value of 0, or any value not greater than the base interval, disables backoff and holds the interval constant. It is ignored when availability_callback is NULL. This field was added in version 3 of this structure.
availability_auto_power_manage: boolWhen true, and when the library was built with power-management support, the poll thread is paused automatically when the operating system suspends and resumed when it wakes. When false, or on builds and platforms without power-management support, this field has no effect and the application MAY drive pausing itself. Use prism_availability_auto_power_supported to determine whether this field is honored. It is ignored when availability_callback is NULL. This field was added in version 3 of this structure.
availability_baseline_callback: PrismAvailabilityBaselineCallbackA function invoked exactly once per context, on the poll thread, after the first availability scan has completed and before the first invocation of availability_callback, or NULL. It receives availability_userdata. It is ignored when availability_callback is NULL. This field was added in version 4 of this structure.