Skip to main content

TaskBuilder

Struct TaskBuilder 

Source
pub struct TaskBuilder<Ctx> { /* private fields */ }
Expand description

Declares the set of channels a task will receive on.

Build it up with add_channel, add_unbounded, or add_bounded, each of which returns a Channel token to hold onto. Then pass the builder to Reactor::spawn to start the task.

Implementations§

Source§

impl<Ctx> TaskBuilder<Ctx>

Source

pub fn new() -> Self

Create an empty builder.

Source

pub fn add_channel(&mut self, priority: u8, capacity: Capacity) -> Channel<Ctx>

Register a channel with the given priority (0 = highest) and capacity.

Multiple channels may share the same priority; among equals the default scheduler visits them in registration order.

Source

pub fn add_unbounded(&mut self, priority: u8) -> Channel<Ctx>

Convenience: register an unbounded channel.

Source

pub fn add_bounded(&mut self, priority: u8, capacity: usize) -> Channel<Ctx>

Convenience: register a bounded channel with the given capacity.

Source

pub fn channel_count(&self) -> usize

Number of channels registered so far.

Trait Implementations§

Source§

impl<Ctx> Default for TaskBuilder<Ctx>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<Ctx> Freeze for TaskBuilder<Ctx>

§

impl<Ctx> RefUnwindSafe for TaskBuilder<Ctx>

§

impl<Ctx> Send for TaskBuilder<Ctx>

§

impl<Ctx> Sync for TaskBuilder<Ctx>

§

impl<Ctx> Unpin for TaskBuilder<Ctx>

§

impl<Ctx> UnsafeUnpin for TaskBuilder<Ctx>

§

impl<Ctx> UnwindSafe for TaskBuilder<Ctx>

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.