Skip to main content

SignalHandler

Struct SignalHandler 

Source
pub struct SignalHandler { /* private fields */ }
Expand description

Registry of named signal handlers.

Implementations§

Source§

impl SignalHandler

Source

pub fn new() -> Self

Source

pub fn register(&mut self, name: &str, signal: &str, priority: i32)

Register a handler for a signal.

Source

pub fn unregister(&mut self, name: &str) -> bool

Unregister a handler.

Source

pub fn set_enabled(&mut self, name: &str, enabled: bool) -> bool

Enable or disable a handler.

Source

pub fn dispatch(&mut self, signal: &str, timestamp: u64) -> usize

Dispatch a signal; calls all enabled handlers sorted by priority desc.

Source

pub fn get(&self, name: &str) -> Option<&HandlerEntry>

Source

pub fn handler_count(&self) -> usize

Source

pub fn total_dispatched(&self) -> u64

Source

pub fn dispatch_log_len(&self) -> usize

Source

pub fn clear_log(&mut self)

Source

pub fn clear_all(&mut self)

Source

pub fn is_empty(&self) -> bool

Trait Implementations§

Source§

impl Default for SignalHandler

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.