-
Notifications
You must be signed in to change notification settings - Fork 42
pb: Add copy method to generated messages
#539
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
Conversation
Mr3zee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm, and please see the changes before merging
...mmonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Api.kt
Show resolved
Hide resolved
...uf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Any.kt
Outdated
Show resolved
Hide resolved
|
@Mr3zee I replaced the |
Mr3zee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love the doc gen for invoke
Subsystem
Protobuf
Problem Description
Messages had no
copymethod to easily creating an altered message instance.Solution
This PR adds the
copy {}extension function, which will produce a deep copy of the receiver message.Users can override copied fields as with the
invoke/constructor function.Limitation
The copy function should also preserve all unknown message fields.
However, as unknown fields are not yet stored (just discarded), this isn't implemented yet.