Merge pull request #553 from matthiasbeyer/libimagstore/custom-hook-error-data-interface

Add interface for custom error data type
This commit is contained in:
Matthias Beyer 2016-07-16 19:15:39 +02:00 committed by GitHub
commit 2a95d4f79d

View file

@ -1,4 +1,6 @@
use std::convert::Into; use std::convert::Into;
use std::default::Default;
generate_error_imports!(); generate_error_imports!();
generate_custom_error_types!(HookError, HookErrorKind, CustomData, generate_custom_error_types!(HookError, HookErrorKind, CustomData,
@ -12,6 +14,25 @@ pub struct CustomData {
aborting: bool, 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 { impl HookError {
pub fn is_aborting(&self) -> bool { pub fn is_aborting(&self) -> bool {