1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
//! # `object`
//!
//! The `object` crate provides a unified interface to working with object files
//! across platforms. It supports reading relocatable object files and executable files,
//! and writing relocatable object files and some executable files.
//!
//! ## Raw struct definitions
//!
//! Raw structs are defined for: [ELF](elf), [Mach-O](macho), [PE/COFF](pe),
//! [XCOFF](xcoff), [archive].
//! Types and traits for zerocopy support are defined in the [`pod`] and [`endian`] modules.
//!
//! ## Unified read API
//!
//! The [`read`] module provides a unified read API using the [`read::Object`] trait.
//! There is an implementation of this trait for [`read::File`], which allows reading any
//! file format, as well as implementations for each file format.
//!
//! ## Low level read API
//!
//! The [`read#modules`] submodules 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.
//!
//! ## Unified write API
//!
//! The [`mod@write`] module provides a unified write API for relocatable object files
//! using [`write::Object`]. This does not support writing executable files.
//!
//! ## Low level write API
//!
//! The [`mod@write#modules`] submodules define helpers for writing the raw structs.
//!
//! ## Shared definitions
//!
//! The crate provides a number of definitions that are used by both the read and write
//! APIs. These are defined at the top level module, but none of these are the main entry
//! points of the crate.
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
#![no_std]
#![warn(rust_2018_idioms)]
// Style.
#![allow(clippy::collapsible_if)]
#![allow(clippy::comparison_chain)]
#![allow(clippy::manual_flatten)]
#![allow(clippy::match_like_matches_macro)]
#![allow(clippy::single_match)]
#![allow(clippy::type_complexity)]
// Occurs due to fallible iteration.
#![allow(clippy::should_implement_trait)]
// Unit errors are converted to other types by callers.
#![allow(clippy::result_unit_err)]
// Worse readability sometimes.
#![allow(clippy::collapsible_else_if)]
#[cfg(feature = "cargo-all")]
compile_error!("'--all-features' is not supported; use '--features all' instead");
#[cfg(any(feature = "read_core", feature = "write_core"))]
#[allow(unused_imports)]
#[macro_use]
extern crate alloc;
#[cfg(feature = "std")]
#[allow(unused_imports)]
#[macro_use]
extern crate std;
mod common;
pub use common::*;
#[macro_use]
pub mod endian;
pub use endian::*;
#[macro_use]
pub mod pod;
pub use pod::*;
#[cfg(feature = "read_core")]
pub mod read;
#[cfg(feature = "read_core")]
pub use read::*;
#[cfg(feature = "write_core")]
pub mod write;
#[cfg(feature = "archive")]
pub mod archive;
#[cfg(feature = "elf")]
pub mod elf;
#[cfg(feature = "macho")]
pub mod macho;
#[cfg(any(feature = "coff", feature = "pe"))]
pub mod pe;
#[cfg(feature = "xcoff")]
pub mod xcoff;