Struct TaskGroup

Source
pub struct TaskGroup<In, Out, T: Task<In, Out>, const STACK_SIZE: usize> { /* private fields */ }
Expand description

Represents a group of tasks.

Implementations§

Source§

impl<In, Out, T: Task<In, Out>, const STACK_SIZE: usize> TaskGroup<In, Out, T, STACK_SIZE>

Source

pub fn tasks(&self) -> usize

Returns the number of tasks in the group.

Source

pub fn has_task(&self, index: usize) -> bool

Check if we have task with index

Source

pub fn add_task(&mut self, task: T) -> usize

Adds a task to the group.

Source

pub fn set_task(&mut self, index: usize, task: T) -> usize

Set task to a slot index

Source

pub fn remove_task(&mut self, index: usize)

Remove a task from the group

Source

pub fn on_tick(&mut self, now: Instant)

Fire tick event to all tasks, after that we need to call pop_output util it return None

Source

pub fn on_event(&mut self, now: Instant, index: usize, input: In) -> Option<()>

Send event to correct task with index

Source

pub fn on_shutdown(&mut self, now: Instant)

Gracefully destroys the task group.

Trait Implementations§

Source§

impl<In: Debug, Out: Debug, T: Debug + Task<In, Out>, const STACK_SIZE: usize> Debug for TaskGroup<In, Out, T, STACK_SIZE>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<In, Out, T: Task<In, Out>, const STACK_SIZE: usize> Default for TaskGroup<In, Out, T, STACK_SIZE>

Source§

fn default() -> Self

Creates a new task group with the specified worker ID.

Source§

impl<In, Out, T: Task<In, Out>, const STACK_SIZE: usize> TaskSwitcherChild<TaskGroupOutput<Out>> for TaskGroup<In, Out, T, STACK_SIZE>

Source§

fn pop_output(&mut self, now: Self::Time) -> Option<TaskGroupOutput<Out>>

Retrieves the output from the flagged processed task.

Source§

type Time = <T as TaskSwitcherChild<Out>>::Time

Source§

fn empty_event(&self) -> TaskGroupOutput<Out>

Source§

fn is_empty(&self) -> bool

Auto Trait Implementations§

§

impl<In, Out, T, const STACK_SIZE: usize> Freeze for TaskGroup<In, Out, T, STACK_SIZE>
where T: Freeze,

§

impl<In, Out, T, const STACK_SIZE: usize> RefUnwindSafe for TaskGroup<In, Out, T, STACK_SIZE>

§

impl<In, Out, T, const STACK_SIZE: usize> Send for TaskGroup<In, Out, T, STACK_SIZE>
where In: Send, Out: Send, T: Send,

§

impl<In, Out, T, const STACK_SIZE: usize> Sync for TaskGroup<In, Out, T, STACK_SIZE>
where In: Sync, Out: Sync, T: Sync,

§

impl<In, Out, T, const STACK_SIZE: usize> Unpin for TaskGroup<In, Out, T, STACK_SIZE>
where In: Unpin, Out: Unpin, T: Unpin,

§

impl<In, Out, T, const STACK_SIZE: usize> UnwindSafe for TaskGroup<In, Out, T, STACK_SIZE>
where In: UnwindSafe, Out: UnwindSafe, T: UnwindSafe,

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.