Update pdl-compiler to 0.1.3 am: d43572c91e

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

Change-Id: I913a85587b1f1e719ff1b86763ad3941321f84cc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
tree: e00e76908c9390c398f7ffc6ca31cf93b9aaa8ea
  1. doc/
  2. examples/
  3. scripts/
  4. src/
  5. tests/
  6. .cargo_vcs_info.json
  7. .gitignore
  8. Android.bp
  9. Cargo.toml
  10. Cargo.toml.orig
  11. cargo2android.json
  12. cargo2android_toplevel.bp
  13. CONTRIBUTING.md
  14. LICENSE
  15. METADATA
  16. MODULE_LICENSE_APACHE2
  17. OWNERS
  18. README.md
  19. rustfmt.toml
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
  • Nested packets
  • Conditional packet derivation
  • Custom field definitions

Similar projects