#enums #serialization #protobuf #sea-orm #deserialize #serde #prost

macro prost-enum

Enhance Enums of prost generated files to support serde and sea-orm

5 releases

0.1.1 Oct 29, 2024
0.1.0 Sep 20, 2024
0.0.2 Oct 5, 2023
0.0.1 Oct 5, 2023
0.0.0 Jun 5, 2023

#990 in Encoding

Download history 8/week @ 2024-07-29 162/week @ 2024-09-16 25/week @ 2024-09-23 9/week @ 2024-09-30 5/week @ 2024-10-07 231/week @ 2024-10-28 10/week @ 2024-11-04

241 downloads per month

MIT license

9KB
158 lines

Usage

Use prost_enum::enhance to make protobuf enums support better serialize / deserialize.

(Optional) Make enums to be used in Sea-ORM, which will be treated as i32 / Integer.

// In build.rs
let mut config = prost_build::Config::new();
// ...
config.enum_attribute(
    ".",
    "#[prost_enum::enhance]",
);
// ...

Dependencies

~0.3–2.2MB
~37K SLoC