proto_convert_derive

Crates.ioproto_convert_derive
lib.rsproto_convert_derive
version0.1.15
created_at2025-03-08 22:49:08.722689+00
updated_at2025-03-16 08:04:57.597011+00
descriptionAutomatically derive Protobuf and Rust conversions.
homepage
repositoryhttps://github.com/protortyp/proto_convert_derive
max_upload_size
id1584888
size31,624
Christian Engel (protortyp)

documentation

https://docs.rs/proto_convert_derive

README

proto_convert_derive

Automatically derive conversions between Protobuf-compiled prost types and your native Rust types.

Overview

proto_convert_derive is a procedural macro for bidirectional conversions between Protobuf-generated types (prost) and Rust structs. This reduces boilerplate and handles proto3's lack of required fields (which result in Option and lots .expect or if let Some in your code. This macro simply .expects types.

Key Features

  • Automatically implements From<Proto> for Rust types and vice versa.
  • Supports collections like Vec<Proto>
  • Direct mapping for primitive types.
  • Unwraps optional fields with .expect.
  • Supports newtype wrappers.
  • Customizable Protobuf module (default is proto via #[proto(module = "your_module")]).
  • Ignore individual fields #[proto(ignore)]

Usage

Head to the examples.

Commit count: 23

cargo fmt