Skip to content

Commit

Permalink
add UnwindSafe impl for AsDynError
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmicexplorer committed Oct 8, 2021
1 parent 00956f1 commit 2fd08cc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/aserror.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::error::Error;
use std::panic::UnwindSafe;

pub trait AsDynError<'a> {
fn as_dyn_error(&self) -> &(dyn Error + 'a);
Expand Down Expand Up @@ -31,3 +32,10 @@ impl<'a> AsDynError<'a> for dyn Error + Send + Sync + 'a {
self
}
}

impl<'a> AsDynError<'a> for dyn Error + Send + Sync + UnwindSafe + 'a {
#[inline]
fn as_dyn_error(&self) -> &(dyn Error + 'a) {
self
}
}

0 comments on commit 2fd08cc

Please sign in to comment.