pub struct PeriodicEmitter { /* private fields */ }Expand description
Periodic emitter that generates events at regular intervals.
Implementations§
Source§impl PeriodicEmitter
impl PeriodicEmitter
Sourcepub fn new(config: &PhyTraceConfig, event_tx: Sender<UdmEvent>) -> Self
pub fn new(config: &PhyTraceConfig, event_tx: Sender<UdmEvent>) -> Self
Create a new periodic emitter.
Sourcepub async fn set_callback(&self, callback: StateCallback)
pub async fn set_callback(&self, callback: StateCallback)
Set the state callback.
The callback is invoked before each emission to populate the event with current state.
Sourcepub async fn start(&self) -> PhyTraceResult<()>
pub async fn start(&self) -> PhyTraceResult<()>
Start the periodic emitter.
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Check if the emitter is running.
Sourcepub fn set_interval(&mut self, interval: Duration)
pub fn set_interval(&mut self, interval: Duration)
Update the emission interval.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for PeriodicEmitter
impl !RefUnwindSafe for PeriodicEmitter
impl Send for PeriodicEmitter
impl Sync for PeriodicEmitter
impl Unpin for PeriodicEmitter
impl !UnwindSafe for PeriodicEmitter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more