[−][src]Struct simple_on_shutdown::ShutdownCallbackDummy
Simple type that holds an closure (callback). The closure gets invoked during drop()
.
This works also fine with applications that do gracefully shutdown via signals, like SIGTERM.
Create this type via on_shutdown!(println!("foobar"))
or on_shutdown!({e1; e2; e3; println!("foobar")})
.
See on_shutdown
for more info.
This crate uses the log
crate on the debug
level.
IMPORTANT: Use this on the top level of your main() or whatever your current runtimes main function is! The code gets executed when the context it lives in gets dropped. This can be called multiple times (at least with stable Rust 1.48.0) without problem.
Implementations
impl ShutdownCallbackDummy
[src]
pub fn new(inner: Box<dyn FnMut()>) -> Self
[src]
Constructor. Better use macro on_shutdown
.
Trait Implementations
impl Drop for ShutdownCallbackDummy
[src]
Auto Trait Implementations
impl !RefUnwindSafe for ShutdownCallbackDummy
impl !Send for ShutdownCallbackDummy
impl !Sync for ShutdownCallbackDummy
impl Unpin for ShutdownCallbackDummy
impl !UnwindSafe for ShutdownCallbackDummy
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>,