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

macro prost-enum

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

2 releases

0.0.2 Oct 5, 2023
0.0.1 Oct 5, 2023
0.0.0 Jun 5, 2023

#2134 in Encoding

MIT license

8KB
148 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.4–1.8MB
~41K SLoC