Struct elfio::StringSectionAccessor[][src]

pub struct StringSectionAccessor<'a> { /* fields omitted */ }
Expand description

A section data accessor intended to string tables

For example:

use std::fs::File;
use std::io;
use std::io::{BufReader, Error};
use elfio::{Elfio, StringSectionAccessor}; // Uncomment in the real code

fn main() -> io::Result<()> {
    let elf_file = File::open("tests/files/hello_64")?;
    let mut file_reader = BufReader::new(elf_file);

    let mut elf = elfio::Elfio::new();

    elf.load(&mut file_reader)?;

    let section = elf.get_section_by_name(".strtab");

    match section {
        Some(s) => {
            let strtab = StringSectionAccessor::new(&elf, s);
            println!("{}", strtab.get_string(1));
        }
        None => return Err(Error::new(io::ErrorKind::Other, "section not found")),
    }

    Ok(())
}

Implementations

Creates a new instance of the string table accessor

Returns a string from string table by its index

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.