From 6438f2ff906ca8b97d1d43f5ccd3c22fb5a4cad9 Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Sat, 30 Apr 2022 11:49:51 +0200 Subject: add explicit lifetime annotation to allow borrowing bytes from LoadSegment after Elf went out of scope --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index ef2535d..301944c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -208,8 +208,8 @@ pub struct Elf<'bytes, const N: usize> { load_segments: [Option>; N], } -impl Elf<'_, N> { - pub fn parse(b: &[u8]) -> Result> { +impl<'bytes, const N: usize> Elf<'bytes, N> { + pub fn parse(b: &'bytes [u8]) -> Result> { let mut r = ElfReader::new(b); // @@ -337,7 +337,7 @@ impl Elf<'_, N> { } #[inline] - pub fn load_segments(&self) -> impl Iterator> { + pub fn load_segments(&self) -> impl Iterator> { self.load_segments.iter().flatten() } } -- cgit v1.2.3