thread_panic_restart/thread/trait.rs
1/// Trait alias for functions that can be executed in a recoverable context.
2///
3/// - Functions implementing this trait must satisfy `Fn() + Send + Sync + 'static`.
4pub trait RecoverableFunction: Fn() + Send + Sync + 'static {}
5
6impl<T> RecoverableFunction for T where T: Fn() + Send + Sync + 'static {}
7
8/// Trait alias for error-handling functions used in a recoverable context.
9///
10/// - Functions implementing this trait must accept a `&str` as an error message
11/// and satisfy `Fn(&str) + Send + Sync + 'static`.
12pub trait ErrorHandlerFunction: Fn(&str) + Send + Sync + 'static {}
13
14impl<T> ErrorHandlerFunction for T where T: Fn(&str) + Send + Sync + 'static {}