Protobuf and Struct questions #7797
Answered
by
PeterJohnson
narmstro2020
asked this question in
Q&A
-
Are these only available for immutable data types? |
Beta Was this translation helpful? Give feedback.
Answered by
PeterJohnson
Feb 17, 2025
Replies: 1 comment
-
No, they work for both mutable and immutable data types, and in fact default to mutable operation. See eg Struct.unpackInto() and Struct.isImmutable(). A struct implementation for a mutable data type would set up isImmutable() to return false and provide an unpackInto implementation to mutate the passed-in object. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
narmstro2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No, they work for both mutable and immutable data types, and in fact default to mutable operation. See eg Struct.unpackInto() and Struct.isImmutable(). A struct implementation for a mutable data type would set up isImmutable() to return false and provide an unpackInto implementation to mutate the passed-in object.