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>
impl<Ctx> TaskBuilder<Ctx>
Sourcepub fn add_channel(&mut self, priority: u8, capacity: Capacity) -> Channel<Ctx>
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.
Sourcepub fn add_unbounded(&mut self, priority: u8) -> Channel<Ctx>
pub fn add_unbounded(&mut self, priority: u8) -> Channel<Ctx>
Convenience: register an unbounded channel.
Sourcepub fn add_bounded(&mut self, priority: u8, capacity: usize) -> Channel<Ctx>
pub fn add_bounded(&mut self, priority: u8, capacity: usize) -> Channel<Ctx>
Convenience: register a bounded channel with the given capacity.
Sourcepub fn channel_count(&self) -> usize
pub fn channel_count(&self) -> usize
Number of channels registered so far.
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more