Add external/rust/pica to the default visibility list am: 2ce036f7b4 am: e4f612e976

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

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

Similar projects