Rustler is a Rust library for writing safe, efficient Native Implemented Functions (NIFs) for the Erlang VM (BEAM), primarily used from Elixir. It provides a high-level, type-safe API that abstracts away the low-level C NIF interface, allowing developers to write NIFs in idiomatic Rust with automatic encoding/decoding of Erlang terms. The architecture consists of three main crates: `rustler` (core runtime and type system), `rustler_codegen` (procedural macros for NIF export and derive traits), and `rustler_mix` (Elixir Mix integration for building and loading NIFs). Key entry points include the `init!` macro to register NIFs, the `#[nif]` attribute macro to define functions, and derive macros like `NifStruct`, `NifMap`, and `NifTaggedEnum` for automatic term conversion. Data flows involve Rust functions receiving decoded Erlang terms (via the `Decoder` trait) and returning encoded terms (via the `Encoder` trait), with support for complex types, resources, threading, and serde serialization. External dependencies include the Erlang/OTP NIF API (dynamically loaded), the `inventory` crate for static registration, and optional `serde` and `num-bigint` crates.