[−][src]Trait object::read::elf::SectionHeader
A trait for generic access to SectionHeader32
and SectionHeader64
.
Associated Types
type Word: Into<u64>
type Endian: Endian
type Elf: FileHeader<Word = Self::Word, Endian = Self::Endian>
Required methods
fn sh_name(&self, endian: Self::Endian) -> u32
fn sh_type(&self, endian: Self::Endian) -> u32
fn sh_flags(&self, endian: Self::Endian) -> Self::Word
fn sh_addr(&self, endian: Self::Endian) -> Self::Word
fn sh_offset(&self, endian: Self::Endian) -> Self::Word
fn sh_size(&self, endian: Self::Endian) -> Self::Word
fn sh_link(&self, endian: Self::Endian) -> u32
fn sh_info(&self, endian: Self::Endian) -> u32
fn sh_addralign(&self, endian: Self::Endian) -> Self::Word
fn sh_entsize(&self, endian: Self::Endian) -> Self::Word
Provided methods
fn file_range(&self, endian: Self::Endian) -> Option<(u64, u64)>
Return the offset and size of the section in the file.
Returns None
for sections that have no data in the file.
fn data<'data>(
&self,
endian: Self::Endian,
data: Bytes<'data>
) -> Result<Bytes<'data>, ()>
&self,
endian: Self::Endian,
data: Bytes<'data>
) -> Result<Bytes<'data>, ()>
Return the section data.
Returns Ok(&[])
if the section has no data.
Returns Err
for invalid values.
fn data_as_array<'data, T: Pod>(
&self,
endian: Self::Endian,
data: Bytes<'data>
) -> Result<&'data [T], ()>
&self,
endian: Self::Endian,
data: Bytes<'data>
) -> Result<&'data [T], ()>
Return the section data as a slice of the given type.
Allows padding at the end of the data.
Returns Ok(&[])
if the section has no data.
Returns Err
for invalid values, including bad alignment.
fn notes<'data>(
&self,
endian: Self::Endian,
data: Bytes<'data>
) -> Result<Option<ElfNoteIterator<'data, Self::Elf>>>
&self,
endian: Self::Endian,
data: Bytes<'data>
) -> Result<Option<ElfNoteIterator<'data, Self::Elf>>>
Return a note iterator for the section data.
Returns Ok(None)
if the section does not contain notes.
Returns Err
for invalid values.