[][src]Struct clint::array::HandlerArray

pub struct HandlerArray<'a> { /* fields omitted */ }

Safely use Handlers 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]

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]

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]

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]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]