Impl Debug for CreateHook

This commit is contained in:
Matthias Beyer 2016-07-16 16:26:01 +02:00
parent a8ea51460c
commit e19121f43a

View file

@ -1,4 +1,5 @@
use std::path::PathBuf; use std::path::PathBuf;
use std::fmt::{Debug, Formatter, Error as FmtError};
use toml::Value; use toml::Value;
@ -9,7 +10,6 @@ use libimagstore::hook::position::HookPosition;
use libimagstore::hook::accessor::{HookDataAccessor, HookDataAccessorProvider}; use libimagstore::hook::accessor::{HookDataAccessor, HookDataAccessorProvider};
use libimagstore::hook::accessor::StoreIdAccessor; use libimagstore::hook::accessor::StoreIdAccessor;
#[derive(Debug)]
pub struct CreateHook<'a> { pub struct CreateHook<'a> {
storepath: &'a PathBuf, storepath: &'a PathBuf,
@ -29,6 +29,17 @@ impl<'a> CreateHook<'a> {
} }
impl<'a> Debug for CreateHook<'a> {
fn fmt(&self, fmt: &mut Formatter) -> Result<(), FmtError> {
write!(fmt, "CreateHook(storepath={:?}, repository={}, pos={:?}, cfg={:?}",
self.storepath,
(if self.repository.is_some() { "Some(_)" } else { "None" }),
self.position,
self.config)
}
}
impl<'a> Hook for CreateHook<'a> { impl<'a> Hook for CreateHook<'a> {
fn name(&self) -> &'static str { fn name(&self) -> &'static str {