Add interface for custom error data type

This commit is contained in:
Matthias Beyer 2016-07-16 16:47:24 +02:00
parent 3ee8f26d1e
commit b81750ba09

View file

@ -1,4 +1,6 @@
use std::convert::Into;
use std::default::Default;
generate_error_imports!();
generate_custom_error_types!(HookError, HookErrorKind, CustomData,
@ -12,6 +14,25 @@ pub struct CustomData {
aborting: bool,
}
impl CustomData {
pub fn aborting(mut self, b: bool) -> CustomData {
self.aborting = b;
self
}
}
impl Default for CustomData {
fn default() -> CustomData {
CustomData {
aborting: true
}
}
}
impl HookError {
pub fn is_aborting(&self) -> bool {