diff options
| author | HampusM <hampus@hampusmat.com> | 2026-11-05 12:24:38 +0100 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-11-05 12:24:38 +0100 |
| commit | e5fec9e52ab400fcaf86819035851d797f8b46b9 (patch) | |
| tree | 3123cabdcaf948aaef3e026feebb371c7976ac57 /engine-ecs/src/util.rs | |
| parent | 60c8ce6b9b2f1abd107545027bf65075234a5538 (diff) | |
Diffstat (limited to 'engine-ecs/src/util.rs')
| -rw-r--r-- | engine-ecs/src/util.rs | 59 |
1 files changed, 0 insertions, 59 deletions
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<Value> Deref for BorrowedOrOwned<'_, Value> } } -#[derive(Debug, Clone)] -pub enum Either<A, B> -{ - A(A), - B(B), -} - -impl<A, B> Either<A, B> -{ - #[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<A, B> Iterator for Either<A, B> -where - A: Iterator, - B: Iterator<Item = A::Item>, -{ - type Item = A::Item; - - fn next(&mut self) -> Option<Self::Item> - { - match self { - Self::A(a) => a.next(), - Self::B(b) => b.next(), - } - } -} - -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` |
