From 5d3a26bf2ffd7cbb4488e772ced1ba1a6713a0f8 Mon Sep 17 00:00:00 2001 From: SOmeone Date: Sun, 8 Sep 2024 13:00:52 +0200 Subject: [PATCH] Added conversion --- crates/async-dropper/src/lib.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/crates/async-dropper/src/lib.rs b/crates/async-dropper/src/lib.rs index 8c8282e..bf77823 100644 --- a/crates/async-dropper/src/lib.rs +++ b/crates/async-dropper/src/lib.rs @@ -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> for AsyncDropError { + fn from(value: Box) -> Self { + AsyncDropError::UnexpectedError(value) + } +} +// Create a impl for anyhow::Error to allow ? to be used with AsyncDropError +impl From for AsyncDropError { + fn from(value: anyhow::Error) -> Self { + AsyncDropError::UnexpectedError(Box::new(value)) + } +}