[Rust] Derive more traits#4142
Conversation
* Simple enums: add: Clone, Copy, Eq, Ord, PartialOrd, Hash * Structs and complex enums: add `Clone`
|
I've not looked closely, but does this work when the enum contains |
|
I don't believe the "simple" enums that get these traits will ever contain other types. The enum values are generated as so these are just a simple list of names that don't contain anything else. |
|
I agree that having "Cloneable" models can be usefull. I often add the derivation after generating client code. |
|
CircleCI failure not related to this PR. |
|
@borsboom Looks like there's no further feedback. Thanks for the PR. |
|
@borsboom thanks for the PR, which has been included in the v4.2.2 release: https://twitter.com/oas_generator/status/1201432648544972800 |
|
Eq and Hash doesnt get generated anymore. |
PR checklist
./bin/to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh,./bin/openapi3/{LANG}-petstore.shif updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\. If contributing template-only or documentation-only changes which will change sample output, be sure to build the project first.master,4.1.x,5.0.x. Default:master.Description of the PR
This adds some common standard traits to the generated models:
Clone.Clone,Copy,Eq,Ord,PartialOrd,Hash.These end up coming in really handy for client code.
/cc @frol @farcaller @bjgill @richardwhiuk