From f9cc0e41ce691e110bc25fc0ee9b188296260b63 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Fri, 30 Oct 2015 16:50:02 +0100 Subject: [PATCH] Implement Display for FileHeaderSpec --- src/storage/file.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/storage/file.rs b/src/storage/file.rs index 72d7a83a..bc1c57c9 100644 --- a/src/storage/file.rs +++ b/src/storage/file.rs @@ -31,6 +31,27 @@ pub trait FileData : Sized { fn get_abbrev(&self) -> String; } +impl Display for FileHeaderSpec { + + fn fmt(&self, fmt: &mut Formatter) -> fmt::Result { + match self { + &FileHeaderSpec::Null => write!(fmt, "NULL"), + &FileHeaderSpec::Bool => write!(fmt, "Bool"), + &FileHeaderSpec::Integer => write!(fmt, "Integer"), + &FileHeaderSpec::UInteger => write!(fmt, "UInteger"), + &FileHeaderSpec::Float => write!(fmt, "Float"), + &FileHeaderSpec::Text => write!(fmt, "Text"), + &FileHeaderSpec::Key{name: ref n, value_type: ref vt} => { + write!(fmt, "Key({:?}) -> {:?}", n, vt) + } + &FileHeaderSpec::Array{allowed_types: ref at} => { + write!(fmt, "Array({:?})", at) + } + } + } + +} + pub struct MatchError { summary: String, path: Vec,