pub fn with_interruption_handler<R>(
handler: impl FnMut() -> bool + 'static,
body: impl FnOnce() -> R,
) -> RExpand description
Runs body with handler installed as the interruption handler of the
calling thread, restoring the previous handler afterwards. See
set_interruption_handler.
ยงExamples
use igraph::prelude::*;
use igraph::misc;
let g = Graph::from_edges(&[(0, 1), (1, 2), (2, 0)], 3, false)?;
let err = misc::with_interruption_handler(|| true, || g.sir(1.0, 1.0, 10)).unwrap_err();
assert_eq!(err.kind(), ErrorKind::Interrupted);