From a2e6c8a461dccf50b5d9cba3ee9032609a3a059a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20M=C3=BCller?= Date: Fri, 20 Dec 2024 17:14:56 -0800 Subject: [PATCH] Remove ElfNBoxedSlice type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the introduction of an address based cache for ELF symbols, we no longer require the ElfNBoxedSlice type. Remove it. Signed-off-by: Daniel Müller --- src/elf/types.rs | 49 ------------------------------------------------ 1 file changed, 49 deletions(-) diff --git a/src/elf/types.rs b/src/elf/types.rs index 2142b011..caeb45b0 100644 --- a/src/elf/types.rs +++ b/src/elf/types.rs @@ -103,54 +103,6 @@ where } -#[derive(Debug)] -pub(crate) enum ElfNBoxedSlice<'elf, T> -where - T: Has32BitTy, -{ - B32(Box<[&'elf T::Ty32Bit]>), - B64(Box<[&'elf T]>), -} - -impl<'elf, T> ElfNBoxedSlice<'elf, T> -where - T: Has32BitTy, -{ - pub fn empty(tybit32: bool) -> Self { - if tybit32 { - Self::B32(Box::new([])) - } else { - Self::B64(Box::new([])) - } - } - - pub fn get(&self, idx: usize) -> Option> { - match self { - Self::B32(slice) => Some(ElfN::B32(*slice.get(idx)?)), - Self::B64(slice) => Some(ElfN::B64(*slice.get(idx)?)), - } - } - - pub fn len(&self) -> usize { - match self { - Self::B32(slice) => slice.len(), - Self::B64(slice) => slice.len(), - } - } - - pub fn is_empty(&self) -> bool { - self.len() == 0 - } - - pub fn iter(&self, start_idx: usize) -> impl ExactSizeIterator> { - match self { - Self::B32(slice) => Either::A(slice[start_idx..].iter().map(|x| ElfN::B32(*x))), - Self::B64(slice) => Either::B(slice[start_idx..].iter().map(|x| ElfN::B64(*x))), - } - } -} - - pub(crate) trait Has32BitTy { type Ty32Bit; } @@ -568,7 +520,6 @@ impl Has32BitTy for Elf64_Sym { pub(crate) type ElfN_Sym<'elf> = ElfN<'elf, Elf64_Sym>; pub(crate) type ElfN_Syms<'elf> = ElfNSlice<'elf, Elf64_Sym>; -pub(crate) type ElfN_BoxedSyms<'elf> = ElfNBoxedSlice<'elf, Elf64_Sym>; impl ElfN_Sym<'_> { #[inline]