[−][src]Struct clint::array::HandlerArray
Safely use Handler
s by enclosing them in an array.
This type provides a safe wrapper around Handler
by ensuring
that closures are swapped safely using critical sections, and that
the lifetime of those handlers is sufficient by using the inner
scope of with_overrides
/lock_overrides
.
Methods
impl<'a> HandlerArray<'a>
[src]
pub const fn new() -> Self
[src]
Create a new HandlerArray
filled with no-op handlers.
pub fn register<F>(&self, nr: usize, f: &'a mut F) where
F: FnMut() + Send + 'a,
[src]
F: FnMut() + Send + 'a,
Register f
for entry nr
in this array using the default
critical section locker.
pub fn lock_register<F, CS>(&self, cs: &CS, nr: usize, f: &'a mut F) where
F: FnMut() + Send + 'a,
CS: CriticalSection,
[src]
F: FnMut() + Send + 'a,
CS: CriticalSection,
Register f
for entry nr
in this array using cs
to create
a critical section for updating the array.
pub fn call(&self, nr: usize)
[src]
Call the handler for entry nr
.
pub fn with_overrides<'b>(&self, f: impl FnOnce(&HandlerArray<'b>))
[src]
Create a new array for use in f
's scope. The existing
handlers can be overridden using register
or
lock_register
. When f
exits, all previous handlers are
restored.
pub fn lock_overrides<'b, CS>(&self, cs: &CS, f: impl FnOnce(&HandlerArray<'b>)) where
CS: CriticalSection,
[src]
CS: CriticalSection,
Same as with_overrides
but allows you to specify your own
implementation of CriticalSection
instead of using the
default.
Trait Implementations
impl<'a> Debug for HandlerArray<'a>
[src]
impl<'a> Sync for HandlerArray<'a>
[src]
Auto Trait Implementations
impl<'a> !Send for HandlerArray<'a>
Blanket Implementations
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,