From: Zhao Liu <zhao1.liu@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-rust@nongnu.org
Subject: Re: [PATCH 3/5] rust: vmstate: convert to use builder pattern
Date: Tue, 6 May 2025 17:55:55 +0800 [thread overview]
Message-ID: <aBncq8KFTgzcT3jv@intel.com> (raw)
In-Reply-To: <20250505100854.73936-4-pbonzini@redhat.com>
> +unsafe extern "C" fn vmstate_pre_load_cb<
> + T,
> + F: for<'a> FnCall<(&'a T,), Result<(), impl Into<Errno>>>,
> +>(
> + opaque: *mut c_void,
> +) -> c_int {
> + // SAFETY: assumes vmstate_struct! is used correctly
> + let result = F::call((unsafe { &*(opaque.cast::<T>()) },));
> + into_neg_errno(result)
Thanks! Now I see why you used io::ErrorKind.
> +}
...
> + #[must_use]
> + pub const fn pre_load<F: for<'a> FnCall<(&'a T,), Result<(), impl Into<Errno>>>>(
> + mut self,
> + _f: &F,
> + ) -> Self {
Do we need to assert F is not ()?
const { assert!(F::IS_SOME) };
And I think all the other callbacks need to be checked as well.
> + self.0.pre_load = Some(vmstate_pre_load_cb::<T, F>);
> + self
> + }
Thank you :-) ! And though it's a preview,
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
next prev parent reply other threads:[~2025-05-06 9:35 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-05 10:08 [PATCH preview 0/5] rust: allow minimum version of 1.83 Paolo Bonzini
2025-05-05 10:08 ` [PATCH 1/5] meson, cargo: require Rust 1.83.0 Paolo Bonzini
2025-05-05 10:08 ` [PATCH 2/5] rust: use inline const expressions Paolo Bonzini
2025-05-06 9:11 ` Zhao Liu
2025-05-06 10:56 ` Paolo Bonzini
2025-05-05 10:08 ` [PATCH 3/5] rust: vmstate: convert to use builder pattern Paolo Bonzini
2025-05-06 9:55 ` Zhao Liu [this message]
2025-05-06 10:33 ` Paolo Bonzini
2025-05-05 10:08 ` [PATCH 4/5] rust: vmstate: use const_refs_to_static Paolo Bonzini
2025-05-07 7:59 ` Zhao Liu
2025-05-05 10:08 ` [PATCH 5/5] rust: qdev: const_refs_to_static Paolo Bonzini
2025-05-06 8:56 ` [PATCH preview 0/5] rust: allow minimum version of 1.83 Zhao Liu
2025-05-06 8:43 ` Paolo Bonzini
2025-05-06 9:26 ` Zhao Liu
2025-05-06 9:44 ` Daniel P. Berrangé
2025-05-06 9:48 ` Daniel P. Berrangé
2025-05-06 10:54 ` Paolo Bonzini
2025-05-06 11:52 ` Daniel P. Berrangé
2025-05-06 13:41 ` Paolo Bonzini
2025-05-06 15:56 ` Zhao Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aBncq8KFTgzcT3jv@intel.com \
--to=zhao1.liu@intel.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-rust@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.