prost-wkt
prost-wkt copied to clipboard
Change parameter of `try_pack` from `T` to `&T`
Any::try_pack takes message: T as parameter, consuming it.
However, taking message: &T instead of message: T would work too, allowing the callers to reuse message.
Good point. Let me check if this can simply be added as well.
Same for unpack. A common pattern would be to try to unpack as a series of different types, but taking self by ownership prevents this and forces you to explicitly check the type url first.
AFAICT it's a trivial change, since self never actually needs to get consumed in the unpacking functions.