Skip to content

Commit

Permalink
✨ Add typedef AnyRes
Browse files Browse the repository at this point in the history
  • Loading branch information
czy-29 committed Nov 21, 2024
1 parent 34f3149 commit d04eed5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ rust-version = "1.80.0"
all-features = true

[dependencies]
anyhow = "1.0.93"

[dev-dependencies]

Expand Down
15 changes: 2 additions & 13 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
#![cfg_attr(nightly, feature(doc_auto_cfg))]

pub fn add(left: usize, right: usize) -> usize {
left + right
}
pub mod result;

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
pub use result::AnyRes;
2 changes: 2 additions & 0 deletions src/result.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// `Result` with default types.
pub type AnyRes<T = (), E = anyhow::Error> = Result<T, E>;

0 comments on commit d04eed5

Please sign in to comment.