Hooks must implement Debug

This commit is contained in:
Matthias Beyer 2016-02-17 16:15:11 +01:00
parent bb0e7e2468
commit 6af5be15ad

View file

@ -3,72 +3,82 @@ use self::error::HookError;
pub type HookResult<T> = Result<T, HookError>; pub type HookResult<T> = Result<T, HookError>;
pub mod read { pub mod read {
use std::fmt::Debug;
use storeid::StoreId; use storeid::StoreId;
use store::FileLockEntry; use store::FileLockEntry;
use super::HookResult; use super::HookResult;
pub trait PreReadHook { pub trait PreReadHook : Debug {
fn pre_read(&self, &StoreId) -> HookResult<()>; fn pre_read(&self, &StoreId) -> HookResult<()>;
} }
pub trait PostReadHook { pub trait PostReadHook : Debug {
fn post_read<'a>(&self, FileLockEntry<'a>) -> HookResult<FileLockEntry<'a>>; fn post_read<'a>(&self, FileLockEntry<'a>) -> HookResult<FileLockEntry<'a>>;
} }
} }
pub mod create { pub mod create {
use std::fmt::Debug;
use storeid::StoreId; use storeid::StoreId;
use store::FileLockEntry; use store::FileLockEntry;
use super::HookResult; use super::HookResult;
pub trait PreCreateHook { pub trait PreCreateHook : Debug {
fn pre_create(&self, &StoreId) -> HookResult<()>; fn pre_create(&self, &StoreId) -> HookResult<()>;
} }
pub trait PostCreateHook { pub trait PostCreateHook : Debug {
fn post_create<'a>(&self, FileLockEntry<'a>) -> HookResult<FileLockEntry<'a>>; fn post_create<'a>(&self, FileLockEntry<'a>) -> HookResult<FileLockEntry<'a>>;
} }
} }
pub mod retrieve { pub mod retrieve {
use std::fmt::Debug;
use storeid::StoreId; use storeid::StoreId;
use store::FileLockEntry; use store::FileLockEntry;
use super::HookResult; use super::HookResult;
pub trait PreRetrieveHook { pub trait PreRetrieveHook : Debug {
fn pre_retrieve(&self, &StoreId) -> HookResult<()>; fn pre_retrieve(&self, &StoreId) -> HookResult<()>;
} }
pub trait PostRetrieveHook { pub trait PostRetrieveHook : Debug {
fn post_retrieve<'a>(&self, FileLockEntry<'a>) -> HookResult<FileLockEntry<'a>>; fn post_retrieve<'a>(&self, FileLockEntry<'a>) -> HookResult<FileLockEntry<'a>>;
} }
} }
pub mod update { pub mod update {
use std::fmt::Debug;
use store::FileLockEntry; use store::FileLockEntry;
use super::HookResult; use super::HookResult;
pub trait PreUpdateHook { pub trait PreUpdateHook : Debug {
fn pre_update(&self, &FileLockEntry) -> HookResult<()>; fn pre_update(&self, &FileLockEntry) -> HookResult<()>;
} }
pub trait PostUpdateHook { pub trait PostUpdateHook : Debug {
fn post_update(&self, &FileLockEntry) -> HookResult<()>; fn post_update(&self, &FileLockEntry) -> HookResult<()>;
} }
} }
pub mod delete { pub mod delete {
use std::fmt::Debug;
use storeid::StoreId; use storeid::StoreId;
use store::FileLockEntry; use store::FileLockEntry;
use super::HookResult; use super::HookResult;
pub trait PreDeleteHook { pub trait PreDeleteHook : Debug {
fn pre_delete(&self, &StoreId) -> HookResult<()>; fn pre_delete(&self, &StoreId) -> HookResult<()>;
} }
pub trait PostDeleteHook { pub trait PostDeleteHook : Debug {
fn post_delete(&self, &StoreId) -> HookResult<()>; fn post_delete(&self, &StoreId) -> HookResult<()>;
} }
} }