-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(build): Expose prost-build type_attributes and field_attribu… (#60)
* chore: Add tags to .gitignore When generating ctags/universal-ctags, a 'tags' file is generated. This commit adds any generted 'tags' file to .gitignore. * feat(build): Expose type_attribute and field_attribute This commit exposes the `type_attribute` and `field_attribute` configuration settings from Prost. These are useful to tweak/extend the generated types. For example: ``` tonic_build::configure() .out_dir(tmp) .format(false) .type_attribute(".", "#[derive(Serialize, Deserialize)]") .type_attribute(".", "#[serde(rename_all = \"camelCase\")]") .field_attribute("in", "#[serde(rename = \"in\")]") .compile(&["tests/protos/wellknown.proto"], &["tests/protos"]) .unwrap(); ``` Would add the serde `Serialize` and `Deserialize` traits, while renaming all the fields to camelCase, and having serde keep fields named `in` named `in`, rather than Prost's `in_`, to every type generated by Prost.
- Loading branch information
1 parent
8db3961
commit 06ff619
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/target | ||
**/*.rs.bk | ||
Cargo.lock | ||
tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters