any.rs |
|
46771 |
archive.rs |
Support for archive files.
## Example
```no_run
use object::{Object, ObjectSection};
use std::error::Error;
use std::fs;
/// Reads an archive and displays the name of each member.
fn main() -> Result<(), Box<dyn Error>> {
# #[cfg(feature = "std")] {
let data = fs::read("path/to/binary")?;
let file = object::read::archive::ArchiveFile::parse(&*data)?;
for member in file.members() {
let member = member?;
println!("{}", String::from_utf8_lossy(member.name()));
}
# }
Ok(())
}
``` |
41810 |
coff |
|
|
elf |
|
|
gnu_compression.rs |
|
1491 |
macho |
|
|
mod.rs |
Interface for reading object files.
## Unified read API
The [`Object`] trait provides a unified read API for accessing common features of
object files, such as sections and symbols. There is an implementation of this
trait for [`File`], which allows reading any file format, as well as implementations
for each file format:
[`ElfFile`](elf::ElfFile), [`MachOFile`](macho::MachOFile), [`CoffFile`](coff::CoffFile),
[`PeFile`](pe::PeFile), [`WasmFile`](wasm::WasmFile), [`XcoffFile`](xcoff::XcoffFile).
## Low level read API
The submodules for each file format define helpers that operate on the raw structs.
These can be used instead of the unified API, or in conjunction with it to access
details that are not available via the unified API.
See the [submodules](#modules) for examples of the low level read API.
## Naming Convention
Types that form part of the unified API for a file format are prefixed with the
name of the file format.
## Example for unified read API
```no_run
use object::{Object, ObjectSection};
use std::error::Error;
use std::fs;
/// Reads a file and displays the name of each section.
fn main() -> Result<(), Box<dyn Error>> {
# #[cfg(all(feature = "read", feature = "std"))] {
let data = fs::read("path/to/binary")?;
let file = object::File::parse(&*data)?;
for section in file.sections() {
println!("{}", section.name()?);
}
# }
Ok(())
}
``` |
29430 |
pe |
|
|
read_cache.rs |
|
8550 |
read_ref.rs |
|
6153 |
traits.rs |
|
20304 |
util.rs |
|
12541 |
wasm.rs |
Support for reading Wasm files.
[`WasmFile`] implements the [`Object`] trait for Wasm files. |
32845 |
xcoff |
|
|