From b81750ba097977c3e17ff2b4fddc73e10b7942e6 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 16 Jul 2016 16:47:24 +0200 Subject: [PATCH] Add interface for custom error data type --- libimagstore/src/hook/error.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/libimagstore/src/hook/error.rs b/libimagstore/src/hook/error.rs index 1db64c59..956f681e 100644 --- a/libimagstore/src/hook/error.rs +++ b/libimagstore/src/hook/error.rs @@ -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 {