From 82f1f8e52baed17e212d1f103aee64e772399fa9 Mon Sep 17 00:00:00 2001 From: KiraCoding <38864051+KiraCoding@users.noreply.github.com> Date: Fri, 13 Sep 2024 09:28:21 +0200 Subject: [PATCH] wip --- src/header.rs | 28 ---------------------------- src/section.rs | 1 + 2 files changed, 1 insertion(+), 28 deletions(-) delete mode 100644 src/header.rs diff --git a/src/header.rs b/src/header.rs deleted file mode 100644 index 1e5322d..0000000 --- a/src/header.rs +++ /dev/null @@ -1,28 +0,0 @@ -use crate::Base; -use core::slice::from_raw_parts; - -#[derive(Debug)] -pub struct Header { - base: Base, - len: usize, -} - -impl Header { - /// Returns a base pointer of this section. - #[inline] - pub fn base(&self) -> Base { - self.base - } - - /// Returns the length of this section. - #[inline] - #[allow(clippy::len_without_is_empty)] - pub fn len(&self) -> usize { - self.len - } - - #[inline] - pub fn as_slice(&self) -> &[u8] { - unsafe { from_raw_parts(self.base.as_nonnull().as_ptr(), self.len) } - } -} diff --git a/src/section.rs b/src/section.rs index e7b8839..8c113f8 100644 --- a/src/section.rs +++ b/src/section.rs @@ -61,6 +61,7 @@ impl Section { .map(|offset| unsafe { self.base.add(offset) }) } + #[inline] pub(crate) fn new(name: &'static str, base: Base, len: usize) -> Self { Self { name, base, len } }