PSA: LLCPP/Wire unions becoming immutable

10 views
Skip to first unread message

Ian McKellar

unread,
Apr 6, 2022, 7:14:27 PM4/6/22
to fidl-dev
If you don't use the C++ low-level / wire FIDL bindings then please continue having a beautiful day.

Hello friendly Fuchsia hackers,

Following the well received change to make tables in the FIDL wire bindings immutable I've made a follow-up CL to do the same for unions. This removes setters. If you want to set the value of a union you simply assign to it with a new union instance created with one of the factory methods like MyUnion::WithBar(my_bar).

You may be wondering what you have to do to update your code to this new cleaner, safer API. And the answer is nothing. I've updated all of the code that previously mutated wire unions to stop doing that.

Ian

PS: if I were a comic book nerd then I'd have made all kinds of X-Men jokes about mutations, but sadly, I'm not so I didn't.
Reply all
Reply to author
Forward
0 new messages