Implement Display for FileHeaderSpec
This commit is contained in:
parent
96ca9637d1
commit
f9cc0e41ce
1 changed files with 21 additions and 0 deletions
|
@ -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<FileHeaderSpec>,
|
||||
|
|
Loading…
Reference in a new issue