use std::error::Error; use std::fmt::Error as FmtError; use std::fmt::{Display, Formatter}; use std::convert::Into; generate_error_types!(HookError, HookErrorKind, HookExecutionError => "Hook exec error", AccessTypeViolation => "Hook access type violation" ); pub trait IntoHookError { fn into_hookerror(self) -> HookError; fn into_hookerror_with_cause(self, cause: Box) -> HookError; } impl Into for HookErrorKind { fn into(self) -> HookError { HookError::new(self, None) } } impl Into for (HookErrorKind, Box) { fn into(self) -> HookError { HookError::new(self.0, Some(self.1)) } }