Trait object::read::macho::section::Section

source ·
pub trait Section: Debug + Pod {
    type Word: Into<u64>;
    type Endian: Endian;

Show 14 methods // Required methods fn sectname(&self) -> &[u8; 16]; fn segname(&self) -> &[u8; 16]; fn addr(&self, endian: Self::Endian) -> Self::Word; fn size(&self, endian: Self::Endian) -> Self::Word; fn offset(&self, endian: Self::Endian) -> u32; fn align(&self, endian: Self::Endian) -> u32; fn reloff(&self, endian: Self::Endian) -> u32; fn nreloc(&self, endian: Self::Endian) -> u32; fn flags(&self, endian: Self::Endian) -> u32; // Provided methods fn name(&self) -> &[u8] { ... } fn segment_name(&self) -> &[u8] { ... } fn file_range(&self, endian: Self::Endian) -> Option<(u64, u64)> { ... } fn data<'data, R: ReadRef<'data>>( &self, endian: Self::Endian, data: R, ) -> Result<&'data [u8], ()> { ... } fn relocations<'data, R: ReadRef<'data>>( &self, endian: Self::Endian, data: R, ) -> Result<&'data [Relocation<Self::Endian>]> { ... }
}
Expand description

A trait for generic access to macho::Section32 and macho::Section64.

Required Associated Types§

Required Methods§

source

fn sectname(&self) -> &[u8; 16]

source

fn segname(&self) -> &[u8; 16]

source

fn addr(&self, endian: Self::Endian) -> Self::Word

source

fn size(&self, endian: Self::Endian) -> Self::Word

source

fn offset(&self, endian: Self::Endian) -> u32

source

fn align(&self, endian: Self::Endian) -> u32

source

fn reloff(&self, endian: Self::Endian) -> u32

source

fn nreloc(&self, endian: Self::Endian) -> u32

source

fn flags(&self, endian: Self::Endian) -> u32

Provided Methods§

source

fn name(&self) -> &[u8]

Return the sectname bytes up until the null terminator.

source

fn segment_name(&self) -> &[u8]

Return the segname bytes up until the null terminator.

source

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.

source

fn data<'data, R: ReadRef<'data>>( &self, endian: Self::Endian, data: R, ) -> Result<&'data [u8], ()>

Return the section data.

Returns Ok(&[]) if the section has no data. Returns Err for invalid values.

source

fn relocations<'data, R: ReadRef<'data>>( &self, endian: Self::Endian, data: R, ) -> Result<&'data [Relocation<Self::Endian>]>

Return the relocation array.

Returns Err for invalid values.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<Endian: Endian> Section for Section32<Endian>

§

type Word = u32

§

type Endian = Endian

source§

impl<Endian: Endian> Section for Section64<Endian>

§

type Word = u64

§

type Endian = Endian