diff options
| author | HampusM <hampus@hampusmat.com> | 2026-07-03 22:22:42 +0200 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-07-03 22:22:42 +0200 |
| commit | 7f529801932fa98967b4dc959d4e9bb79511ff79 (patch) | |
| tree | de2ee2c876b47e3983b5e99ef33fce950da1d8a1 /engine-ecs/src | |
| parent | 23c4199cac2ce8c0c91ac1e3d9b46fcc1ff72d7a (diff) | |
feat(engine-ecs): add Display impl to Either enum
Diffstat (limited to 'engine-ecs/src')
| -rw-r--r-- | engine-ecs/src/util.rs | 15 |
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` |
