Skip to content

Instantly share code, notes, and snippets.

@loverdos
Last active June 15, 2024 12:00
Show Gist options
  • Save loverdos/c15f1ecc6d242f30d64ea1e220b96cc5 to your computer and use it in GitHub Desktop.
Save loverdos/c15f1ecc6d242f30d64ea1e220b96cc5 to your computer and use it in GitHub Desktop.
use std::error::Error;
pub fn do_error_source<F>(source_opt: Option<&dyn Error>, f: F)
where
F: Fn(&dyn Error),
{
match source_opt {
None => {}
Some(source) => {
f(source);
do_error_source(source.source(), f);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment