Struct kernel::deferred_call::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>,

§

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

§

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.