tafia / quick-protobuf

A rust implementation of protobuf parser
MIT License
452 stars 87 forks source link

builder for proto object may be more helperful #254

Open miaomiao1992 opened 10 months ago

miaomiao1992 commented 10 months ago

this is my proto:

syntax = "proto3";

message GetRequest { string name = 1; int32 age = 2; repeated string features = 3; }

this is my rs files: let req = GetRequest { name: Cow::Borrowed("name1"), age: 11, features: vec![Cow::Borrowed("features 1")], };

if wo have a builder, we can

let req=GetRequestBuilder::default() .name("name1") .age(11) .features(&["features 1"]) .build();

Is this easier?