Struct hotshot_task::task::ConsensusTaskRegistry
source · pub struct ConsensusTaskRegistry<EVENT> {
task_handles: Vec<JoinHandle<Box<dyn TaskState<Event = EVENT>>>>,
}
Expand description
A collection of tasks which can handle shutdown
Fields§
§task_handles: Vec<JoinHandle<Box<dyn TaskState<Event = EVENT>>>>
Tasks this registry controls
Implementations§
source§impl<EVENT: Send + Sync + Clone + TaskEvent> ConsensusTaskRegistry<EVENT>
impl<EVENT: Send + Sync + Clone + TaskEvent> ConsensusTaskRegistry<EVENT>
sourcepub fn register(
&mut self,
handle: JoinHandle<Box<dyn TaskState<Event = EVENT>>>,
)
pub fn register( &mut self, handle: JoinHandle<Box<dyn TaskState<Event = EVENT>>>, )
Add a task to the registry
sourcepub async fn shutdown(&mut self)
pub async fn shutdown(&mut self)
Try to cancel/abort the task this registry has
§Panics
Should not panic, unless awaiting on the JoinHandle in tokio fails.
Trait Implementations§
source§impl<EVENT: Default> Default for ConsensusTaskRegistry<EVENT>
impl<EVENT: Default> Default for ConsensusTaskRegistry<EVENT>
source§fn default() -> ConsensusTaskRegistry<EVENT>
fn default() -> ConsensusTaskRegistry<EVENT>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<EVENT> Freeze for ConsensusTaskRegistry<EVENT>
impl<EVENT> RefUnwindSafe for ConsensusTaskRegistry<EVENT>
impl<EVENT> Send for ConsensusTaskRegistry<EVENT>
impl<EVENT> Sync for ConsensusTaskRegistry<EVENT>
impl<EVENT> Unpin for ConsensusTaskRegistry<EVENT>
impl<EVENT> UnwindSafe for ConsensusTaskRegistry<EVENT>
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