[][src]Struct tari_shutdown::Shutdown

pub struct Shutdown { /* fields omitted */ }

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]

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

impl Default for Shutdown[src]

impl Drop for Shutdown[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.