diff options
author | Johannes Stoelp <johannes.stoelp@gmail.com> | 2022-04-30 11:49:51 +0200 |
---|---|---|
committer | Johannes Stoelp <johannes.stoelp@gmail.com> | 2022-04-30 11:49:51 +0200 |
commit | 6438f2ff906ca8b97d1d43f5ccd3c22fb5a4cad9 (patch) | |
tree | 388dec2d4a9968d5c760afe0defc0c9b3776845c /src | |
parent | 758aca3189d4e599f9b13eedbf0a6cc3ae18c4cc (diff) | |
download | elfload-6438f2ff906ca8b97d1d43f5ccd3c22fb5a4cad9.tar.gz elfload-6438f2ff906ca8b97d1d43f5ccd3c22fb5a4cad9.zip |
add explicit lifetime annotation to allow borrowing bytes from LoadSegment after Elf went out of scope
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.rs | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -208,8 +208,8 @@ pub struct Elf<'bytes, const N: usize> { load_segments: [Option<LoadSegment<'bytes>>; N], } -impl<const N: usize> Elf<'_, N> { - pub fn parse(b: &[u8]) -> Result<Elf<'_, N>> { +impl<'bytes, const N: usize> Elf<'bytes, N> { + pub fn parse(b: &'bytes [u8]) -> Result<Elf<'bytes, N>> { let mut r = ElfReader::new(b); // @@ -337,7 +337,7 @@ impl<const N: usize> Elf<'_, N> { } #[inline] - pub fn load_segments(&self) -> impl Iterator<Item = &LoadSegment<'_>> { + pub fn load_segments(&self) -> impl Iterator<Item = &LoadSegment<'bytes>> { self.load_segments.iter().flatten() } } |