kernel::deferred_call

Struct DeferredCall

Source
pub struct DeferredCall { /* private fields */ }

Implementations§

Source§

impl DeferredCall

Source

pub fn new() -> Self

Create a new deferred call with a unique ID.

Source

pub fn register<DC: DeferredCallClient>(&self, client: &'static DC)

This function registers the passed client with this deferred call, such that calls to DeferredCall::set() will schedule a callback on the handle_deferred_call() method of the passed client.

Source

pub fn set(&self)

Schedule a deferred callback on the client associated with this deferred call.

Source

pub fn is_pending(&self) -> bool

Check if a deferred callback has been set and not yet serviced on this deferred call.

Source

pub fn service_next_pending() -> Option<usize>

Services and clears the next pending DeferredCall, returns which index was serviced.

Source

pub fn has_tasks() -> bool

Returns true if any deferred calls are waiting to be serviced, false otherwise.

Source

pub fn verify_setup()

This function should be called at the beginning of the kernel loop to verify that deferred calls have been correctly initialized. This function verifies two things:

  1. That <= [DEFCALLS.len()] deferred calls have been created, which is the maximum this interface supports.

  2. That exactly as many deferred calls were registered as were created, which helps to catch bugs if board maintainers forget to call register() on a created DeferredCall.

Neither of these checks are necessary for soundness, but they are necessary for confirming that DeferredCalls will actually be delivered as expected. This function costs about 300 bytes, so you can remove it if you are confident your setup will not exceed 32 deferred calls, and that all of your components register their deferred calls.

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, 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.