extern crate self as kaptan_err_propagate; use kaptan_err_propagate_macros::KaptanError; #[derive(Clone, Copy)] pub struct ErrorId(u16); impl ErrorId { pub const fn new(id: u16) -> Self { Self(id) } pub const fn get(self) -> u16 { self.0 } } pub trait ErrorReport { fn error_id(&self) -> ErrorId; } #[derive(Debug, KaptanError)] enum FirstError { #[kaptan_error(id = 77)] Failed, } #[derive(Debug, KaptanError)] enum SecondError { #[kaptan_error(id = 77)] Failed, } fn main() { let _ = FirstError::Failed.error_id(); let _ = SecondError::Failed.error_id(); }