summaryrefslogtreecommitdiff
path: root/src/utils.rs
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2025-03-03 23:00:19 -0500
committerLLLL Colonq <llll@colonq>2025-03-03 23:00:19 -0500
commit22fbeca88a781aca7bcc965ac8189244497671d6 (patch)
treea4c6e0b26012f151b68539a83a09fba9b6529636 /src/utils.rs
parent901fe3013ea86242f403d6dc867dd45f12700b7a (diff)
Add some helpers for error handling
Diffstat (limited to 'src/utils.rs')
-rw-r--r--src/utils.rs6
1 files changed, 5 insertions, 1 deletions
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<T> = anyhow::Result<T>;
-#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
+pub fn erm<E, T>(e: E) -> Erm<T> 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,