| Crates.io | kinderror |
| lib.rs | kinderror |
| version | 0.1.3 |
| created_at | 2026-01-20 16:00:24.95959+00 |
| updated_at | 2026-01-21 03:04:28.828158+00 |
| description | An io::Error style kind Error derive macro |
| homepage | |
| repository | https://github.com/Sherlock-Holo/kinderror |
| max_upload_size | |
| id | 2056902 |
| size | 18,172 |
An io::Error style kind Error derive macro
use kinderror::KindError;
use std::error::Error as _;
#[derive(KindError, Debug, Eq, PartialEq)]
#[kind_error(
source = "std::io::Error",
source_fn = true,
new_vis = "pub",
name = "Error",
type_vis = "pub",
kind_fn_vis = "pub",
display = "hey, error kind: {kind:?}, source: {source}"
)]
enum ErrorKind {
First,
Second,
}
fn main() {
let err = Error::new(ErrorKind::First, std::io::Error::other("first error"));
assert_eq!(*err.kind(), ErrorKind::First);
assert!(err.source().is_some());
}
MIT