From 7f529801932fa98967b4dc959d4e9bb79511ff79 Mon Sep 17 00:00:00 2001 From: HampusM Date: Fri, 3 Jul 2026 22:22:42 +0200 Subject: feat(engine-ecs): add Display impl to Either enum --- engine-ecs/src/util.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 Display for Either +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 { /// Returns true if the keys are a subset of another [`HashMap`]'s keys, i.e., `other` -- cgit v1.2.3-18-g5258