Trait gimli::Section [] [src]

pub trait Section<R: Reader>: From<R> {
    fn section_name() -> &'static str;
}

A convenience trait for loading DWARF sections from object files. To be used like:

use gimli::{DebugInfo, EndianBuf, LittleEndian, Reader, Section};

fn load_section<R, S, F>(loader: F) -> S
  where R: Reader, S: Section<R>, F: FnOnce(&'static str) -> R
{
  let data = loader(S::section_name());
  S::from(data)
}

let buf = [0x00, 0x01, 0x02, 0x03];
let reader = EndianBuf::new(&buf, LittleEndian);

let debug_info: DebugInfo<_> = load_section(|_: &'static str| reader);

Required Methods

Returns the ELF section name for this type.

Implementors