Upgrade pdl-compiler to 0.2.2 am: fe5d6f1b23 am: 44f11d08ed

Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/pdl-runtime/+/2812414

Change-Id: Ie6c046f6e037656513d690cca25166a8be73dd62
Signed-off-by: Automerger Merge Worker <[email protected]>
tree: 93b217f5b12c69e9ffe07cfae2289a9ebaf31379
  1. src/
  2. Android.bp
  3. Cargo.toml
  4. Cargo.toml.orig
  5. LICENSE
  6. METADATA
  7. MODULE_LICENSE_APACHE2
  8. OWNERS
  9. README.md
README.md

Packet Description Language (PDL)

Crate Build workflow GitHub contributors GitHub stars

PDL is a domain specific language for writing the definition of binary protocol packets. Parsing and validating packets from raw bytes is tedious and error prone in any language. PDL generates memory safe and tailored backends for multiple target languages:

- Rust
- C++
- Python

Historically PDL was developed as part of the Android Bluetooth stack (bluetooth_packetgen) as a way to generate the parser and serializer for Bluetooth packets, and reduce the number of memory safety issues that come with manipulating and validating raw data.

How to use PDL

  1. Write the protocol definition
  2. cargo run my-protocol.pdl --output-format rust > my-protocol.rs

Language specific instructions are provided for all supported backends:

  1. Rust generated code guide
  2. Python generated code guide
  3. C++ generated code guide

Supported Features

Full reference documentation

  • Scalar values
  • Enumerators
  • Arrays
  • Optional fields
  • Nested packets
  • Conditional packet derivation
  • Custom field definitions

Similar projects