pub struct MonitorBuilder { /* private fields */ }Expand description
MonitorBuilder provides a builder pattern for creating monitors with advanced configuration
This follows the PVXS MonitorBuilder pattern, allowing configuration of event masks and callbacks before creating the subscription.
§Example
use pvxs_sys::Context;
let mut ctx = Context::from_env()?;
let monitor = ctx.monitor_builder("MY:PV")?
.connect_exception(true)
.disconnect_exception(true)
.exec()?;Implementations§
Source§impl MonitorBuilder
impl MonitorBuilder
Sourcepub fn connect_exception(self, enable: bool) -> Self
pub fn connect_exception(self, enable: bool) -> Self
Enable or disable connection exceptions in the monitor queue
This is the user-friendly API - think in terms of what you want to enable.
§Arguments
enable- true to throw connection exceptions, false to suppress them (default: false)
§Example
let monitor = ctx.monitor_builder("MY:PV")?
.connect_exception(true) // Throw connection exceptions
.exec()?;Sourcepub fn disconnect_exception(self, enable: bool) -> Self
pub fn disconnect_exception(self, enable: bool) -> Self
Enable or disable disconnection exceptions in the monitor queue
This is the user-friendly API - think in terms of what you want to enable.
§Arguments
enable- true to throw disconnection exceptions, false to suppress them (default: true)
§Example
let monitor = ctx.monitor_builder("MY:PV")?
.disconnect_exception(true) // Throw disconnection exceptions
.exec()?;Sourcepub fn event(self, callback: extern "C" fn()) -> Self
pub fn event(self, callback: extern "C" fn()) -> Self
Set an event callback function that will be invoked when the subscription queue becomes not-empty
This follows the PVXS pattern where the callback is invoked when events are available,
not for each individual event. The callback should then use pop() to retrieve events.
§Arguments
callback- Function to be called when events are available
§Example
extern "C" fn my_callback() {
println!("Events available in subscription queue!");
}
let monitor = ctx.monitor_builder("MY:PV")?
.event(my_callback)
.exec()?;