Module endian

Source
Expand description

An all-safe-code endian-aware integer parsing implementation via the EndianParse trait.

This module provides four endian parsing implementations optimized to support the different common use-cases for an ELF parsing library. Each trait impl represents a specification that encapsulates an interface for parsing integers from some set of allowed byte orderings.

  • AnyEndian: Dynamically parsing either byte order at runtime based on the type of ELF object being parsed.
  • BigEndian/LittleEndian: For tools that know they only want to parse a single given byte order known at compile time.
  • NativeEndian: For tools that know they want to parse the same byte order as the target’s byte order.

Structs§

BigEndian
A zero-sized type that always parses integers as if they’re in big-endian order. This is useful for scenarios where a combiled binary knows it only wants to interpret big-endian ELF files and doesn’t want the performance penalty of evaluating a match each time it parses an integer.
LittleEndian
A zero-sized type that always parses integers as if they’re in little-endian order. This is useful for scenarios where a combiled binary knows it only wants to interpret little-endian ELF files and doesn’t want the performance penalty of evaluating a match each time it parses an integer.

Enums§

AnyEndian
An endian parsing type that can choose at runtime which byte order to parse integers as. This is useful for scenarios where a single compiled binary wants to dynamically interpret ELF files of any byte order.

Traits§

EndianParse
An all-safe-code endian-aware integer parsing trait.

Type Aliases§

NativeEndian
A zero-sized type that always parses integers as if they’re in the compilation target’s native-endian order. This is useful for toolchain scenarios where a combiled binary knows it only wants to interpret ELF files compiled for the same target and doesn’t want the performance penalty of evaluating a match each time it parses an integer.