pub struct Terminator { /* private fields */ }
Expand description
Struct that holds connections to offspring and parent components/tasks and enables a clean/synchronized shutdown
Implementations§
Source§impl Terminator
impl Terminator
Sourcepub fn create_root(exit: Receiver<()>, name: &'static str) -> Self
pub fn create_root(exit: Receiver<()>, name: &'static str) -> Self
Creates a terminator for the root component
Sourcepub async fn get_exit(&mut self) -> Result<(), ()>
pub async fn get_exit(&mut self) -> Result<(), ()>
When ready, returns reason why we should exit. Ok
should be interpreted as “all good, our parent decided to gracefully
exit”. Err
is returned when our parent autonomously decided to exit, without first receiving such request from its
parent.
Sourcepub fn add_offspring_connection(&mut self, name: &'static str) -> Terminator
pub fn add_offspring_connection(&mut self, name: &'static str) -> Terminator
Add a connection to an offspring component/task
Sourcepub async fn terminate_sync(self)
pub async fn terminate_sync(self)
Perform a synchronized shutdown
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Terminator
impl !RefUnwindSafe for Terminator
impl Send for Terminator
impl Sync for Terminator
impl Unpin for Terminator
impl !UnwindSafe for Terminator
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more