From 208aae78ee5b02fedd89947f79008b356c000769 Mon Sep 17 00:00:00 2001 From: Kamil Jarosz Date: Tue, 26 Mar 2024 13:08:38 +0100 Subject: [PATCH] core: Use either crate instead of a custom implementation --- Cargo.lock | 1 + core/Cargo.toml | 1 + core/src/avm2/qname.rs | 2 +- core/src/either.rs | 21 --------------------- core/src/lib.rs | 1 - 5 files changed, 3 insertions(+), 23 deletions(-) delete mode 100644 core/src/either.rs diff --git a/Cargo.lock b/Cargo.lock index 7e211cad5..6960601f9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4184,6 +4184,7 @@ dependencies = [ "downcast-rs", "egui", "egui_extras", + "either", "encoding_rs", "enum-map", "enumset", diff --git a/core/Cargo.toml b/core/Cargo.toml index d2f5668bc..cc4cb764a 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -66,6 +66,7 @@ ttf-parser = "0.20" num-bigint = "0.4" unic-segment = "0.9.0" id3 = "1.13.1" +either = "1.10.0" [target.'cfg(not(target_family = "wasm"))'.dependencies.futures] version = "0.3.30" diff --git a/core/src/avm2/qname.rs b/core/src/avm2/qname.rs index f70aab3ca..59efb7a8a 100644 --- a/core/src/avm2/qname.rs +++ b/core/src/avm2/qname.rs @@ -1,8 +1,8 @@ use crate::avm2::script::TranslationUnit; use crate::avm2::{Activation, Error, Namespace}; use crate::context::UpdateContext; -use crate::either::Either; use crate::string::{AvmString, WStr, WString}; +use either::Either; use gc_arena::{Collect, Mutation}; use std::fmt::Debug; use swf::avm2::types::{Index, Multiname as AbcMultiname}; diff --git a/core/src/either.rs b/core/src/either.rs deleted file mode 100644 index 4f7167c9e..000000000 --- a/core/src/either.rs +++ /dev/null @@ -1,21 +0,0 @@ -use std::ops::Deref; - -pub enum Either { - Left(A), - Right(B), -} - -impl Deref for Either -where - A: Deref, - B: Deref, -{ - type Target = A::Target; - - fn deref(&self) -> &Self::Target { - match self { - Self::Left(a) => a, - Self::Right(b) => b, - } - } -} diff --git a/core/src/lib.rs b/core/src/lib.rs index fc43e8084..2a76613d5 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -29,7 +29,6 @@ pub mod context; pub mod context_menu; mod drawing; mod ecma_conversions; -pub(crate) mod either; pub mod events; pub mod focus_tracker; mod font;