Struct HandlerTable
pub struct HandlerTable<const N: usize> { /* private fields */ }Available on crate feature
irq only.Expand description
A lock-free table of event handlers.
It internally uses an array of AtomicUsize to store the handlers.
Implementations§
§impl<const N: usize> HandlerTable<N>
impl<const N: usize> HandlerTable<N>
pub const fn new() -> HandlerTable<N>
pub const fn new() -> HandlerTable<N>
Creates a new handler table with all entries empty.
pub fn register_handler(&self, idx: usize, handler: fn()) -> bool
pub fn register_handler(&self, idx: usize, handler: fn()) -> bool
Registers a handler for the given index.
Returns true if the registration succeeds, false if the index is out
of bounds or the handler is already registered.
pub fn unregister_handler(&self, idx: usize) -> Option<fn()>
pub fn unregister_handler(&self, idx: usize) -> Option<fn()>
Unregisters the handler for the given index.
Returns the existing handler if it is registered, None otherwise.
Trait Implementations§
§impl<const N: usize> Default for HandlerTable<N>
impl<const N: usize> Default for HandlerTable<N>
§fn default() -> HandlerTable<N>
fn default() -> HandlerTable<N>
Returns the “default value” for a type. Read more