[−][src]Struct tari_shutdown::Shutdown
Trigger for shutdowns.
Use to_signal
to create a future which will resolve when Shutdown
is triggered.
Use trigger
to signal. All signals will resolve.
Note: This will trigger when dropped, so the Shutdown
instance should be held as
long as required by the application.
Implementations
impl Shutdown
[src]
pub fn new() -> Self
[src]
Create a new Shutdown
pub fn on_triggered<F>(&mut self, on_trigger: F) -> &mut Self where
F: FnOnce() + Send + Sync + 'static,
[src]
F: FnOnce() + Send + Sync + 'static,
Set the on_triggered callback
pub fn to_signal(&self) -> ShutdownSignal
[src]
Convert this into a ShutdownSignal without consuming the struct.
pub fn trigger(&mut self) -> Result<(), ()>
[src]
Trigger any listening signals
pub fn is_triggered(&self) -> bool
[src]
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Shutdown
[src]
impl Send for Shutdown
[src]
impl Sync for Shutdown
[src]
impl Unpin for Shutdown
[src]
impl !UnwindSafe for Shutdown
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,