[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 04/26] rust: define prelude
From: |
Paolo Bonzini |
Subject: |
[PATCH 04/26] rust: define prelude |
Date: |
Mon, 9 Dec 2024 13:36:55 +0100 |
Add a module that will contain frequently used traits and
occasionally structs. They can be included quickly with
"use qemu_api::prelude::*".
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
rust/qemu-api/meson.build | 1 +
rust/qemu-api/src/lib.rs | 5 +++++
rust/qemu-api/src/prelude.rs | 6 ++++++
3 files changed, 12 insertions(+)
create mode 100644 rust/qemu-api/src/prelude.rs
diff --git a/rust/qemu-api/meson.build b/rust/qemu-api/meson.build
index cacb112c5c3..f8b4cd39a26 100644
--- a/rust/qemu-api/meson.build
+++ b/rust/qemu-api/meson.build
@@ -21,6 +21,7 @@ _qemu_api_rs = static_library(
'src/definitions.rs',
'src/device_class.rs',
'src/offset_of.rs',
+ 'src/prelude.rs',
'src/vmstate.rs',
'src/zeroable.rs',
],
diff --git a/rust/qemu-api/src/lib.rs b/rust/qemu-api/src/lib.rs
index b04d110b3f5..e5956cd5eb6 100644
--- a/rust/qemu-api/src/lib.rs
+++ b/rust/qemu-api/src/lib.rs
@@ -7,6 +7,11 @@
#[rustfmt::skip]
pub mod bindings;
+// preserve one-item-per-"use" syntax, it is clearer
+// for prelude-like modules
+#[rustfmt::skip]
+pub mod prelude;
+
pub mod c_str;
pub mod cell;
pub mod definitions;
diff --git a/rust/qemu-api/src/prelude.rs b/rust/qemu-api/src/prelude.rs
new file mode 100644
index 00000000000..dfaddbd062a
--- /dev/null
+++ b/rust/qemu-api/src/prelude.rs
@@ -0,0 +1,6 @@
+// Copyright 2024 Red Hat, Inc.
+// Author(s): Paolo Bonzini <pbonzini@redhat.com>
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+pub use crate::cell::BqlCell;
+pub use crate::cell::BqlRefCell;
--
2.47.1
- [PATCH 00/26] rust: bundle of prerequisites for HPET implementation, Paolo Bonzini, 2024/12/09
- [PATCH 01/26] bql: check that the BQL is not dropped within marked sections, Paolo Bonzini, 2024/12/09
- [PATCH 03/26] rust: cell: add BQL-enforcing RefCell variant, Paolo Bonzini, 2024/12/09
- [PATCH 02/26] rust: cell: add BQL-enforcing Cell variant, Paolo Bonzini, 2024/12/09
- [PATCH 07/26] rust: qom: add default definitions for ObjectImpl, Paolo Bonzini, 2024/12/09
- [PATCH 04/26] rust: define prelude,
Paolo Bonzini <=
- [PATCH 06/26] rust: add a bit operation module, Paolo Bonzini, 2024/12/09
- [PATCH 05/26] rust: add bindings for interrupt sources, Paolo Bonzini, 2024/12/09
- [PATCH 08/26] rust: qom: rename Class trait to ClassInitImpl, Paolo Bonzini, 2024/12/09
- [PATCH 10/26] rust: qom: move ClassInitImpl to the instance side, Paolo Bonzini, 2024/12/09