async_callback_manager

Struct AsyncCallbackManager

Source
pub struct AsyncCallbackManager<Bkend, Cstrnt> { /* private fields */ }

Implementations§

Source§

impl<Bkend, Cstrnt: PartialEq> AsyncCallbackManager<Bkend, Cstrnt>

Source

pub fn new() -> Self

Get a new AsyncCallbackManager.

Source

pub fn with_on_task_received_callback( self, cb: impl FnMut(TaskInformation<'_, Cstrnt>) + 'static, ) -> Self

Source

pub fn with_on_response_received_callback( self, cb: impl FnMut(ResponseInformation) + 'static, ) -> Self

Source

pub fn new_sender<Frntend>( &mut self, channel_size: usize, ) -> AsyncCallbackSender<Bkend, Frntend, Cstrnt>

Creates a new AsyncCallbackSender that sends to this Manager. Channel size refers to number of number of state mutations that can be buffered from tasks.

Source

pub async fn manage_next_event( &mut self, backend: &Bkend, ) -> Option<ManagedEventType>

Manage the next event in the queue. Combination of spawn_next_task and process_next_response. Returns Some(ManagedEventType), if something was processed. Returns None, if no senders or tasks exist.

Source

pub async fn spawn_next_task(&mut self, backend: &Bkend) -> Option<()>

Spawns the next incoming task from a sender. Returns Some(()), if a task was spawned. Returns None, if no senders.

Source

pub async fn process_next_response(&mut self) -> Option<ResponseInformation>

Spawns the next incoming task from a sender. Returns Some(ResponseInformation), if a task was spawned. Returns None, if no senders. Note that the ‘on_next_response’ callback is not called, you’re given the ResponseInformation directly.

Trait Implementations§

Source§

impl<Bkend, Cstrnt: PartialEq> Default for AsyncCallbackManager<Bkend, Cstrnt>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<Bkend, Cstrnt> Freeze for AsyncCallbackManager<Bkend, Cstrnt>

§

impl<Bkend, Cstrnt> !RefUnwindSafe for AsyncCallbackManager<Bkend, Cstrnt>

§

impl<Bkend, Cstrnt> !Send for AsyncCallbackManager<Bkend, Cstrnt>

§

impl<Bkend, Cstrnt> !Sync for AsyncCallbackManager<Bkend, Cstrnt>

§

impl<Bkend, Cstrnt> Unpin for AsyncCallbackManager<Bkend, Cstrnt>
where Cstrnt: Unpin,

§

impl<Bkend, Cstrnt> !UnwindSafe for AsyncCallbackManager<Bkend, Cstrnt>

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.