mindustry logic execution, map- and schematic- parsing and rendering
Diffstat (limited to 'src/content.rs')
| -rw-r--r-- | src/content.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/content.rs b/src/content.rs index 3172096..3e7fd0b 100644 --- a/src/content.rs +++ b/src/content.rs @@ -65,13 +65,20 @@ macro_rules! content_enum { } } - impl std::fmt::Display for $error - { + impl std::fmt::Display for $error { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "no content of type {} for value {}", stringify!($ctype), self.0) } } + impl std::fmt::Display for $tname { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + $(Self::[<$val:camel>] => f.write_str(strconv::kebab2title!($val)),)* + } + } + } + impl std::error::Error for $error {} } }; |