mindustry logic execution, map- and schematic- parsing and rendering
Diffstat (limited to 'src/item/storage.rs')
-rw-r--r--src/item/storage.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/item/storage.rs b/src/item/storage.rs
index d78273c..5f57b75 100644
--- a/src/item/storage.rs
+++ b/src/item/storage.rs
@@ -322,6 +322,21 @@ impl PartialEq for Storage
}
}
+impl fmt::Display for Storage
+{
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
+ {
+ let mut first = true;
+ for (ty, cnt) in self.iter_nonzero()
+ {
+ if first {first = false;}
+ else {f.write_str(", ")?;}
+ write!(f, "{cnt} {ty}")?;
+ }
+ Ok(())
+ }
+}
+
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub struct TryAddError
{