use std::io;
pub(super) fn was_interrupted(err: &io::Error) -> bool {
matches!(
err.kind(),
io::ErrorKind::Interrupted | io::ErrorKind::WouldBlock
)
}
pub(super) fn retry_while_interrupted<T>(mut f: impl FnMut() -> io::Result<T>) -> io::Result<T> {
loop {
match f() {
Err(err) if was_interrupted(&err) => {}
result => return result,
}
}
}