From 22fbeca88a781aca7bcc965ac8189244497671d6 Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Mon, 3 Mar 2025 23:00:19 -0500 Subject: Add some helpers for error handling --- src/utils.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/utils.rs') diff --git a/src/utils.rs b/src/utils.rs index f5ce271..b2d1868 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -2,7 +2,11 @@ use serde::{Serialize, Deserialize}; pub type Erm = anyhow::Result; -#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] +pub fn erm(e: E) -> Erm where E: std::error::Error + std::marker::Send + std::marker::Sync + 'static { + Err(anyhow::Error::from(e)) +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] pub enum Cardinal { North, South, -- cgit v1.2.3