Skip to content

Commit

Permalink
Added conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
SOmeone authored and SOmeone committed Sep 8, 2024
1 parent be3a06e commit 5d3a26b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions crates/async-dropper/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,16 @@ pub trait AsyncDrop: Default + PartialEq + Eq + ResetDefault {
DropFailAction::Continue
}
}

// Create an impl for AsyncDropError to allow ? to be used with AsyncDropError
impl From<Box<dyn std::error::Error>> for AsyncDropError {
fn from(value: Box<dyn std::error::Error>) -> Self {
AsyncDropError::UnexpectedError(value)
}
}
// Create a impl for anyhow::Error to allow ? to be used with AsyncDropError
impl From<anyhow::Error> for AsyncDropError {
fn from(value: anyhow::Error) -> Self {
AsyncDropError::UnexpectedError(Box::new(value))
}
}

0 comments on commit 5d3a26b

Please sign in to comment.