pub(crate) mod blocking_worker;
mod bootstrap;
mod builder;
pub(crate) mod config;
pub(crate) mod dispatch;
mod error;
mod handle;
mod operations;
pub(crate) mod telemetry;
pub(crate) mod thread;
mod worker;
#[doc(inline)]
pub use builder::RuntimeBuilder;
#[doc(inline)]
pub use config::{BlockingPoolPolicy, WorkersPolicy};
#[doc(inline)]
pub use error::Error;
#[doc(inline)]
pub use handle::Runtime;
#[doc(inline)]
pub use operations::RuntimeOperations;
#[cfg(feature = "macros")]
pub mod __private {
#[cfg(any(test, feature = "test-util"))]
pub use crate::time::ClockControl;
pub fn resume_error(error: super::Error) -> ! {
match error.into_source().downcast::<crate::task::JoinError>() {
Ok(error) if error.is_panic() => {
std::panic::resume_unwind(error.into_panic().expect("the join error was checked as a panic"));
}
Ok(_) => std::panic::resume_unwind(Box::new("runtime is shutting down")),
Err(error) => std::panic::resume_unwind(Box::new(error.to_string())),
}
}
#[cfg(test)]
#[cfg_attr(coverage_nightly, coverage(off))]
mod tests {
#[test]
fn non_join_failure_preserves_its_diagnostic_payload() {
let payload = std::panic::catch_unwind(|| {
super::resume_error(crate::runtime::Error::new("runtime control failed"));
})
.unwrap_err();
assert_eq!(*payload.downcast::<String>().unwrap(), "runtime control failed");
}
}
}