[rustmojo] Remove Clone from MojomValue
This is a preparatory CL to pave the way for supporting Mojom handles in
our parser and deparser. Since handle values aren't clonable, the
`MojomValue` type can't be either, so we remove it and take care of all
the resulting problems. Fortunately, no uses were fundamentally
required.
Mostly, this CL doesn't change any behavior, just restructures code to
satisfy the borrow checker. The major downside is that we need to use
slightly uglier code in several places to accommodate the fact that our
values now get consumed. Frequently this means using `let...else`
instead of `if...let...else`, and reconstructing values for error
messages.
This CL also adjusts when we derive Clone for structs generated by the
bindings code. Specifically, we generate it iff there aren't any handles
in the type. This is a convenience for the user, who might well expect
to be able to clone a value which only contains ints, for example.
Bug: 444509367
Change-Id: I2ef204ccc2d084996e8bec7c5ad3813bc49afe78
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7568603
Reviewed-by: Ćukasz Anforowicz <lukasza@chromium.org>
Commit-Queue: Devon Loehr <dloehr@google.com>
Cr-Commit-Position: refs/heads/main@{#1584887}
CrOS-Libchrome-Original-Commit: b73b2b32fcc61e23b3fa18176c2fd21de0bd9c02
9 files changed