2 releases
0.1.1 | Jul 17, 2024 |
---|---|
0.1.0 | Jul 17, 2024 |
#1610 in Encoding
5KB
53 lines
prost-uuid-doubleint
Custom uuid type for using in protobuf .proto files.
Represents uuid as 2 u64 integers.
Usage
Proto files
You need to have a file with Uuid
syntax = "proto3";
package uuid;
message Uuid {
uint64 high = 1;
uint64 low = 2;
}
and import it from another .proto file
syntax = "proto3";
package user;
import "uuid.proto";
message User {
uuid.Uuid id = 1;
string name = 2;
}
Cargo.toml
...
[dependencies]
prost = "0.13"
prost-uuid-doubleint = "0.1.0"
...
Build.rs
...
prost_build::Config::new()
.extern_path(".uuid.Uuid", "::prost_uuid_doubleint::ProstUuid")
.compile_protos(&["./proto/user.proto"], &["./proto"])
...
Tnanks to
Dependencies
~0.7–1.2MB
~24K SLoC