From af2f09ea4cbb97d3ee91e30bb58e85508989d63a Mon Sep 17 00:00:00 2001 From: clarkzjw Date: Wed, 26 Jul 2023 12:37:38 -0700 Subject: add example from https://github.com/LemmyNet/activitypub-federation-rust --- fedi/live_federation/error.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 fedi/live_federation/error.rs (limited to 'fedi/live_federation/error.rs') diff --git a/fedi/live_federation/error.rs b/fedi/live_federation/error.rs new file mode 100644 index 0000000..3ef1819 --- /dev/null +++ b/fedi/live_federation/error.rs @@ -0,0 +1,20 @@ +use std::fmt::{Display, Formatter}; + +/// Necessary because of this issue: https://github.com/actix/actix-web/issues/1711 +#[derive(Debug)] +pub struct Error(pub(crate) anyhow::Error); + +impl Display for Error { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + std::fmt::Display::fmt(&self.0, f) + } +} + +impl From for Error +where + T: Into, +{ + fn from(t: T) -> Self { + Error(t.into()) + } +} -- cgit v1.2.3