pub fn is_rt_shutdown_err(err: &Error) -> boolAvailable on crate feature
rt only.Expand description
Checks whether the given error was emitted by Tokio when shutting down its runtime.
ยงExamples
use tokio::runtime::Runtime;
use tokio::net::TcpListener;
fn main() {
let rt1 = Runtime::new().unwrap();
let rt2 = Runtime::new().unwrap();
let listener = rt1.block_on(async {
TcpListener::bind("127.0.0.1:0").await.unwrap()
});
drop(rt1);
rt2.block_on(async {
let res = listener.accept().await;
assert!(res.is_err());
assert!(tokio::runtime::is_rt_shutdown_err(res.as_ref().unwrap_err()));
});
}