Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

builder for proto object may be more helperful #254

Open
miaomiao1992 opened this issue Jan 14, 2024 · 0 comments
Open

builder for proto object may be more helperful #254

miaomiao1992 opened this issue Jan 14, 2024 · 0 comments

Comments

@miaomiao1992
Copy link

miaomiao1992 commented Jan 14, 2024

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?

@miaomiao1992 miaomiao1992 changed the title builder for proto object may be helperful builder for proto object may be more helperful Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant