Struct hotshot_task::task::Task
source · pub struct Task<S: TaskState> {
state: S,
sender: Sender<Arc<S::Event>>,
receiver: Receiver<Arc<S::Event>>,
}
Expand description
A basic task which loops waiting for events to come from event_receiver
and then handles them using its state
It sends events to other Task
s through sender
This should be used as the primary building block for long running
or medium running tasks (i.e. anything that can’t be described as a dependency task)
Fields§
§state: S
The state of the task. It is fed events from receiver
and mutated via handle_event
.
sender: Sender<Arc<S::Event>>
Sends events all tasks including itself
receiver: Receiver<Arc<S::Event>>
Receives events that are broadcast from any task, including itself
Implementations§
Auto Trait Implementations§
impl<S> Freeze for Task<S>where
S: Freeze,
impl<S> RefUnwindSafe for Task<S>where
S: RefUnwindSafe,
impl<S> Send for Task<S>
impl<S> Sync for Task<S>where
S: Sync,
impl<S> Unpin for Task<S>where
S: Unpin,
impl<S> UnwindSafe for Task<S>where
S: UnwindSafe,
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