summaryrefslogtreecommitdiff
path: root/engine-ecs
diff options
context:
space:
mode:
Diffstat (limited to 'engine-ecs')
-rw-r--r--engine-ecs/src/util.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/engine-ecs/src/util.rs b/engine-ecs/src/util.rs
index 8de44e4..a6bd14b 100644
--- a/engine-ecs/src/util.rs
+++ b/engine-ecs/src/util.rs
@@ -1,3 +1,4 @@
+use std::fmt::Display;
use std::hash::Hash;
use std::mem::transmute;
use std::ops::{BitAnd, Deref};
@@ -137,6 +138,20 @@ where
}
}
+impl<A, B> Display for Either<A, B>
+where
+ A: Display,
+ B: Display,
+{
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result
+ {
+ match self {
+ Self::A(a) => a.fmt(f),
+ Self::B(b) => b.fmt(f),
+ }
+ }
+}
+
pub trait HashMapExt<Key, Value>
{
/// Returns true if the keys are a subset of another [`HashMap`]'s keys, i.e., `other`