From 55d6de627acd995229a4a56e7e07ed2f9b051a09 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Fri, 27 Nov 2015 19:31:46 +0100 Subject: [PATCH] Add debug output in match_header_spec() --- src/storage/file.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/storage/file.rs b/src/storage/file.rs index 74f49a23..a5bc4024 100644 --- a/src/storage/file.rs +++ b/src/storage/file.rs @@ -113,6 +113,7 @@ impl<'a> Display for MatchError<'a> { pub fn match_header_spec<'a>(spec: &'a FileHeaderSpec, data: &'a FileHeaderData) -> Option> { + debug!("Start matching:\n'{:?}'\non\n{:?}", spec, data); match (spec, data) { (&FileHeaderSpec::Null, &FileHeaderData::Null) => { } (&FileHeaderSpec::Bool, &FileHeaderData::Bool(_)) => { } @@ -125,7 +126,11 @@ pub fn match_header_spec<'a>(spec: &'a FileHeaderSpec, data: &'a FileHeaderData) &FileHeaderSpec::Key{name: ref kname, value_type: ref vtype}, &FileHeaderData::Key{name: ref n, value: ref val} ) => { + debug!("Matching Key: '{:?}' == '{:?}', Value: '{:?}' == '{:?}'", + kname, n, + vtype, val); if kname != n { + debug!("Keys not matching"); unimplemented!(); } return match_header_spec(&*vtype, &*val); @@ -135,6 +140,8 @@ pub fn match_header_spec<'a>(spec: &'a FileHeaderSpec, data: &'a FileHeaderData) &FileHeaderSpec::Map{keys: ref sks}, &FileHeaderData::Map{keys: ref dks} ) => { + debug!("Matching Map: '{:?}' == '{:?}'", sks, dks); + for (s, d) in sks.iter().zip(dks.iter()) { let res = match_header_spec(s, d); if res.is_some() { @@ -147,6 +154,7 @@ pub fn match_header_spec<'a>(spec: &'a FileHeaderSpec, data: &'a FileHeaderData) &FileHeaderSpec::Array{allowed_types: ref vtypes}, &FileHeaderData::Array{values: ref vs} ) => { + debug!("Matching Array: '{:?}' == '{:?}'", vtypes, vs); for (t, v) in vtypes.iter().zip(vs.iter()) { let res = match_header_spec(t, v); if res.is_some() {