aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2022-04-30 11:49:51 +0200
committerJohannes Stoelp <johannes.stoelp@gmail.com>2022-04-30 11:49:51 +0200
commit6438f2ff906ca8b97d1d43f5ccd3c22fb5a4cad9 (patch)
tree388dec2d4a9968d5c760afe0defc0c9b3776845c /src
parent758aca3189d4e599f9b13eedbf0a6cc3ae18c4cc (diff)
downloadelfload-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.rs6
1 files 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<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()
}
}