diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2024-12-06 17:08:49 +0100 |
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2025-02-13 12:19:33 +0100 |
| commit | 66bcc554d27f693f89bf04df24d474463a90a894 (patch) | |
| tree | 1bce253895e365cdef36ee57e1af50607159cbdd /rust/qemu-api/src/vmstate.rs | |
| parent | ec3eba98967014f942bafb4307303d853d96e7e7 (diff) | |
| download | focaccia-qemu-66bcc554d27f693f89bf04df24d474463a90a894.tar.gz focaccia-qemu-66bcc554d27f693f89bf04df24d474463a90a894.zip | |
rust: callbacks: allow passing optional callbacks as ()
In some cases, callbacks are optional. Using "Some(function)" and "None" does not work well, because when someone writes "None" the compiler does not know what to use for "F" in "Option<F>". Therefore, adopt () to mean a "null" callback. It is possible to enforce that a callback is valid by adding a "let _: () = F::ASSERT_IS_SOME" before the invocation of F::call. Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'rust/qemu-api/src/vmstate.rs')
0 files changed, 0 insertions, 0 deletions