pub struct SignalHandler { /* private fields */ }Expand description
Registry of named signal handlers.
Implementations§
Source§impl SignalHandler
impl SignalHandler
pub fn new() -> Self
Sourcepub fn register(&mut self, name: &str, signal: &str, priority: i32)
pub fn register(&mut self, name: &str, signal: &str, priority: i32)
Register a handler for a signal.
Sourcepub fn unregister(&mut self, name: &str) -> bool
pub fn unregister(&mut self, name: &str) -> bool
Unregister a handler.
Sourcepub fn set_enabled(&mut self, name: &str, enabled: bool) -> bool
pub fn set_enabled(&mut self, name: &str, enabled: bool) -> bool
Enable or disable a handler.
Sourcepub fn dispatch(&mut self, signal: &str, timestamp: u64) -> usize
pub fn dispatch(&mut self, signal: &str, timestamp: u64) -> usize
Dispatch a signal; calls all enabled handlers sorted by priority desc.
pub fn get(&self, name: &str) -> Option<&HandlerEntry>
pub fn handler_count(&self) -> usize
pub fn total_dispatched(&self) -> u64
pub fn dispatch_log_len(&self) -> usize
pub fn clear_log(&mut self)
pub fn clear_all(&mut self)
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SignalHandler
impl RefUnwindSafe for SignalHandler
impl Send for SignalHandler
impl Sync for SignalHandler
impl Unpin for SignalHandler
impl UnsafeUnpin for SignalHandler
impl UnwindSafe for SignalHandler
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