core: Use either crate instead of a custom implementation

This commit is contained in:
Kamil Jarosz 2024-03-26 13:08:38 +01:00 committed by Adrian Wielgosik
parent bc9aa18d6f
commit 208aae78ee
5 changed files with 3 additions and 23 deletions

1
Cargo.lock generated
View File

@ -4184,6 +4184,7 @@ dependencies = [
"downcast-rs", "downcast-rs",
"egui", "egui",
"egui_extras", "egui_extras",
"either",
"encoding_rs", "encoding_rs",
"enum-map", "enum-map",
"enumset", "enumset",

View File

@ -66,6 +66,7 @@ ttf-parser = "0.20"
num-bigint = "0.4" num-bigint = "0.4"
unic-segment = "0.9.0" unic-segment = "0.9.0"
id3 = "1.13.1" id3 = "1.13.1"
either = "1.10.0"
[target.'cfg(not(target_family = "wasm"))'.dependencies.futures] [target.'cfg(not(target_family = "wasm"))'.dependencies.futures]
version = "0.3.30" version = "0.3.30"

View File

@ -1,8 +1,8 @@
use crate::avm2::script::TranslationUnit; use crate::avm2::script::TranslationUnit;
use crate::avm2::{Activation, Error, Namespace}; use crate::avm2::{Activation, Error, Namespace};
use crate::context::UpdateContext; use crate::context::UpdateContext;
use crate::either::Either;
use crate::string::{AvmString, WStr, WString}; use crate::string::{AvmString, WStr, WString};
use either::Either;
use gc_arena::{Collect, Mutation}; use gc_arena::{Collect, Mutation};
use std::fmt::Debug; use std::fmt::Debug;
use swf::avm2::types::{Index, Multiname as AbcMultiname}; use swf::avm2::types::{Index, Multiname as AbcMultiname};

View File

@ -1,21 +0,0 @@
use std::ops::Deref;
pub enum Either<A, B> {
Left(A),
Right(B),
}
impl<A, B> Deref for Either<A, B>
where
A: Deref,
B: Deref<Target = A::Target>,
{
type Target = A::Target;
fn deref(&self) -> &Self::Target {
match self {
Self::Left(a) => a,
Self::Right(b) => b,
}
}
}

View File

@ -29,7 +29,6 @@ pub mod context;
pub mod context_menu; pub mod context_menu;
mod drawing; mod drawing;
mod ecma_conversions; mod ecma_conversions;
pub(crate) mod either;
pub mod events; pub mod events;
pub mod focus_tracker; pub mod focus_tracker;
mod font; mod font;