From a5b41dfe21c221fe0a86dc23145c02894c091a3a Mon Sep 17 00:00:00 2001 From: rascul Date: Sat, 16 Mar 2024 17:36:43 -0500 Subject: [PATCH] add tokio-postgres behind feature flag --- Cargo.toml | 1 + src/lib.rs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index a617c73..653345c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ keywords = ["error", "result"] askama = { version = "0.12", optional = true } log = { version = "0.4", features = ["std"], optional = true } serde_json = { version = "1.0", optional = true } +tokio-postgres = { version = "0.7", optional = true} ureq = { version = "2.6", optional = true } [features] diff --git a/src/lib.rs b/src/lib.rs index a1f7b80..c79e102 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -90,6 +90,13 @@ impl From for Rear { } } +#[cfg(feature = "tokio_postgres")] +impl From for Rear { + fn from(error: tokio_postgres::Error) -> Self { + Self { message: error.to_string(), error: error.into() } + } +} + #[cfg(feature = "ureq")] impl From for Rear { fn from(error: ureq::Error) -> Self {