From e5fec9e52ab400fcaf86819035851d797f8b46b9 Mon Sep 17 00:00:00 2001 From: HampusM Date: Thu, 5 Nov 2026 12:24:38 +0100 Subject: refactor(engine-ecs): remove util::Either & use either crate --- engine-ecs/src/util.rs | 59 -------------------------------------------------- 1 file changed, 59 deletions(-) (limited to 'engine-ecs/src/util.rs') diff --git a/engine-ecs/src/util.rs b/engine-ecs/src/util.rs index 304ba21..f3498fa 100644 --- a/engine-ecs/src/util.rs +++ b/engine-ecs/src/util.rs @@ -1,4 +1,3 @@ -use std::fmt::Display; use std::hash::Hash; use std::mem::transmute; use std::ops::{BitAnd, Deref}; @@ -132,64 +131,6 @@ impl Deref for BorrowedOrOwned<'_, Value> } } -#[derive(Debug, Clone)] -pub enum Either -{ - A(A), - B(B), -} - -impl Either -{ - #[inline] - pub fn as_a(&self) -> Option<&A> - { - match self { - Self::A(a) => Some(a), - Self::B(_) => None, - } - } - - #[inline] - pub fn as_b(&self) -> Option<&B> - { - match self { - Self::A(_) => None, - Self::B(b) => Some(b), - } - } -} - -impl Iterator for Either -where - A: Iterator, - B: Iterator, -{ - type Item = A::Item; - - fn next(&mut self) -> Option - { - match self { - Self::A(a) => a.next(), - Self::B(b) => b.next(), - } - } -} - -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