#[allow(unused_imports)]
use anyhow::Context;
pub trait BuilderContext {
fn spawn_scoped_wc < 'scope , 'env , F , T > ( self , scope : & 'scope std :: thread :: Scope < 'scope , 'env > , f : F ) -> crate :: rewrite_output_type ! ( std :: io :: Result < std :: thread :: ScopedJoinHandle < 'scope , T > > ) where F : core :: ops :: FnOnce ( ) -> T + core :: marker :: Send + 'scope , T : core :: marker :: Send + 'scope;
fn spawn_wc < F , T > ( self , f : F ) -> crate :: rewrite_output_type ! ( std :: io :: Result < std :: thread :: JoinHandle < T > > ) where F : core :: ops :: FnOnce ( ) -> T + core :: marker :: Send + 'static , T : core :: marker :: Send + 'static;
#[cfg(feature = "thread_spawn_unchecked")]
unsafe fn spawn_unchecked_wc < F , T > ( self , f : F ) -> crate :: rewrite_output_type ! ( std :: io :: Result < std :: thread :: JoinHandle < T > > ) where F : core :: ops :: FnOnce ( ) -> T + core :: marker :: Send , T : core :: marker :: Send;
}
impl BuilderContext for std :: thread :: Builder {
fn spawn_scoped_wc < 'scope , 'env , F , T > ( self , scope : & 'scope std :: thread :: Scope < 'scope , 'env > , f : F ) -> crate :: rewrite_output_type ! ( std :: io :: Result < std :: thread :: ScopedJoinHandle < 'scope , T > > ) where F : core :: ops :: FnOnce ( ) -> T + core :: marker :: Send + 'scope , T : core :: marker :: Send + 'scope {
std :: thread :: Builder :: spawn_scoped(self, scope, f)
.with_context(|| crate::call_failed!(Some(crate::CustomDebugMessage("value of type std::thread::Builder")), "spawn_scoped", scope, crate::CustomDebugMessage("value of type impl FnOnce")))
}
fn spawn_wc < F , T > ( self , f : F ) -> crate :: rewrite_output_type ! ( std :: io :: Result < std :: thread :: JoinHandle < T > > ) where F : core :: ops :: FnOnce ( ) -> T + core :: marker :: Send + 'static , T : core :: marker :: Send + 'static {
std :: thread :: Builder :: spawn(self, f)
.with_context(|| crate::call_failed!(Some(crate::CustomDebugMessage("value of type std::thread::Builder")), "spawn", crate::CustomDebugMessage("value of type impl FnOnce")))
}
#[cfg(feature = "thread_spawn_unchecked")]
unsafe fn spawn_unchecked_wc < F , T > ( self , f : F ) -> crate :: rewrite_output_type ! ( std :: io :: Result < std :: thread :: JoinHandle < T > > ) where F : core :: ops :: FnOnce ( ) -> T + core :: marker :: Send , T : core :: marker :: Send {
unsafe { std :: thread :: Builder :: spawn_unchecked(self, f)
.with_context(|| crate::call_failed!(Some(crate::CustomDebugMessage("value of type std::thread::Builder")), "spawn_unchecked", crate::CustomDebugMessage("value of type impl FnOnce"))) }
}
}
pub trait ThreadContext {
fn name_wc ( & self ) -> crate :: rewrite_output_type ! ( core :: option :: Option < & str > );
}
impl ThreadContext for std :: thread :: Thread {
fn name_wc ( & self ) -> crate :: rewrite_output_type ! ( core :: option :: Option < & str > ) {
std :: thread :: Thread :: name(self)
.with_context(|| crate::call_failed!(Some(self), "name"))
}
}
pub fn available_parallelism_wc ( ) -> crate :: rewrite_output_type ! ( std :: io :: Result < core :: num :: NonZero < usize > > ) {
std :: thread :: available_parallelism()
.with_context(|| crate::call_failed!(None::<()>, "std::thread::available_parallelism"))
}