pub struct TickService { /* private fields */ }Expand description
Shared tick service that can coordinate multiple WorkerServices.
Implementations§
Source§impl TickService
impl TickService
Sourcepub fn new(tick_duration: Duration) -> Arc<Self>
pub fn new(tick_duration: Duration) -> Arc<Self>
Create a new TickService with the specified default tick duration. The actual tick duration used will be the minimum of the default and all registered handlers.
pub fn register( self: &Arc<Self>, handler: Arc<dyn TickHandler>, ) -> Option<TickHandlerRegistration>
Sourcepub fn shutdown(&self)
pub fn shutdown(&self)
Shutdown the tick service and wait for the thread to exit. This is idempotent - multiple calls are safe.
Sourcepub fn tick_stats(&self) -> TickStatsSnapshot
pub fn tick_stats(&self) -> TickStatsSnapshot
Returns a snapshot of the current tick thread statistics
Sourcepub fn current_tick_duration_ns(&self) -> u64
pub fn current_tick_duration_ns(&self) -> u64
Returns the current tick duration in nanoseconds
Sourcepub fn set_shutdown_timeout(&self, timeout: Duration)
pub fn set_shutdown_timeout(&self, timeout: Duration)
Set the shutdown timeout for handlers
Sourcepub fn error_stats(&self) -> (u64, TickStatsSnapshot)
pub fn error_stats(&self) -> (u64, TickStatsSnapshot)
Get error statistics for the tick service
Sourcepub fn set_panic_logging(&self, enabled: bool)
pub fn set_panic_logging(&self, enabled: bool)
Enable or disable panic logging for handlers
Sourcepub fn is_panic_logging_enabled(&self) -> bool
pub fn is_panic_logging_enabled(&self) -> bool
Check if panic logging is enabled
Sourcepub fn handler_stats(&self) -> Vec<TickStatsSnapshot>
pub fn handler_stats(&self) -> Vec<TickStatsSnapshot>
Returns a vector of tick statistics for each registered handler
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for TickService
impl RefUnwindSafe for TickService
impl Send for TickService
impl Sync for TickService
impl Unpin for TickService
impl UnwindSafe for TickService
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