beam_file 0.2.2

Library for processing Erlang BEAM file

Crate beam_file [] [src]

This crate provides functionality to process Erlang BEAM file.

Examples

Collects ID of chunks in a BEAM file:

use beam_file::StandardBeamFile;
use beam_file::chunk::Chunk;

let beam = StandardBeamFile::from_file("tests/testdata/test.beam").unwrap();

assert_eq!(vec![b"Atom", b"Code", b"StrT", b"ImpT", b"ExpT", b"FunT", b"LitT",
                b"LocT", b"Attr", b"CInf", b"Abst", b"Line"],
           beam.chunks.iter().map(|c| c.id()).collect::<Vec<_>>());

Generates a BEAM file:

use beam_file::RawBeamFile;
use beam_file::chunk::{Chunk, RawChunk};

let chunk = RawChunk{id: *b"Atom", data: Vec::new()}; // NOTICE: The chunk is malformed
let beam = RawBeamFile{chunks: vec![chunk]};
beam.to_file("my.beam").unwrap();

Modules

chunk

The Chunk trait and implementations of commonly used chunks.

parts

A collection of the miscellaneous parts used in a BEAM file.

Structs

BeamFile

A BEAM File

Enums

Error

Type Definitions

RawBeamFile
Result
StandardBeamFile