xemu/rust
Junjie Mao f351840088 rust: introduce alternative implementation of offset_of!
offset_of! was stabilized in Rust 1.77.0.  Use an alternative implemenation
that was found on the Rust forums, and whose author agreed to license as
MIT for use in QEMU.

The alternative allows only one level of field access, but apart
from this can be used just by replacing core::mem::offset_of! with
qemu_api::offset_of!.

The actual implementation of offset_of! is done in a declarative macro,
but for simplicity and to avoid introducing an extra level of indentation,
the trigger is a procedural macro #[derive(offsets)].

The procedural macro is perhaps a bit overengineered, but it helps
introducing some idioms that will be useful in the future as well.

Signed-off-by: Junjie Mao <junjie.mao@hotmail.com>
Co-developed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-11-05 14:18:16 +01:00
..
hw rust: introduce alternative implementation of offset_of! 2024-11-05 14:18:16 +01:00
qemu-api rust: introduce alternative implementation of offset_of! 2024-11-05 14:18:16 +01:00
qemu-api-macros rust: introduce alternative implementation of offset_of! 2024-11-05 14:18:16 +01:00
.gitignore rust: add bindgen step as a meson dependency 2024-10-11 12:32:17 +02:00
Cargo.lock rust: introduce alternative implementation of offset_of! 2024-11-05 14:18:16 +01:00
Cargo.toml rust: create a cargo workspace 2024-11-05 14:18:16 +01:00
Kconfig rust: add PL011 device model 2024-11-05 14:18:15 +01:00
meson.build rust: add PL011 device model 2024-11-05 14:18:15 +01:00
rustfmt.toml rust: add crate to expose bindings and interfaces 2024-10-11 12:32:17 +02:00
wrapper.h rust/wrapper.h: define memory_order enum 2024-11-05 14:18:15 +01:00