From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-rust@nongnu.org
Subject: [PATCH 6/8] bql: add prelude
Date: Mon, 17 Nov 2025 08:42:36 +0100 [thread overview]
Message-ID: <20251117074239.190424-7-pbonzini@redhat.com> (raw)
In-Reply-To: <20251117074239.190424-1-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
rust/bql/meson.build | 1 +
rust/bql/src/lib.rs | 5 +++++
rust/bql/src/prelude.rs | 4 ++++
rust/chardev/src/chardev.rs | 2 +-
rust/hw/char/pl011/src/device.rs | 2 +-
rust/hw/core/tests/tests.rs | 2 +-
rust/hw/timer/hpet/src/device.rs | 2 +-
rust/migration/src/migratable.rs | 2 +-
rust/tests/tests/vmstate_tests.rs | 2 +-
9 files changed, 16 insertions(+), 6 deletions(-)
create mode 100644 rust/bql/src/prelude.rs
diff --git a/rust/bql/meson.build b/rust/bql/meson.build
index 091372dd7b6..90aaadaa6d6 100644
--- a/rust/bql/meson.build
+++ b/rust/bql/meson.build
@@ -31,6 +31,7 @@ _bql_rs = static_library(
'src/lib.rs',
'src/bindings.rs',
'src/cell.rs',
+ 'src/prelude.rs',
],
{'.': _bql_bindings_inc_rs}
),
diff --git a/rust/bql/src/lib.rs b/rust/bql/src/lib.rs
index ef08221e9c1..d2fea5db1ac 100644
--- a/rust/bql/src/lib.rs
+++ b/rust/bql/src/lib.rs
@@ -6,6 +6,11 @@
mod cell;
pub use cell::*;
+// preserve one-item-per-"use" syntax, it is clearer
+// for prelude-like modules
+#[rustfmt::skip]
+pub mod prelude;
+
/// An internal function that is used by doctests.
pub fn start_test() {
// SAFETY: integration tests are run with --test-threads=1, while
diff --git a/rust/bql/src/prelude.rs b/rust/bql/src/prelude.rs
new file mode 100644
index 00000000000..42031ec18ab
--- /dev/null
+++ b/rust/bql/src/prelude.rs
@@ -0,0 +1,4 @@
+//! Essential types and traits intended for blanket imports.
+
+pub use crate::cell::BqlCell;
+pub use crate::cell::BqlRefCell;
diff --git a/rust/chardev/src/chardev.rs b/rust/chardev/src/chardev.rs
index f0b7975dbf7..fb9674b3fb4 100644
--- a/rust/chardev/src/chardev.rs
+++ b/rust/chardev/src/chardev.rs
@@ -18,7 +18,7 @@
slice,
};
-use bql::{BqlRefCell, BqlRefMut};
+use bql::{prelude::*, BqlRefMut};
use common::{callbacks::FnCall, errno, Opaque};
use qom::prelude::*;
diff --git a/rust/hw/char/pl011/src/device.rs b/rust/hw/char/pl011/src/device.rs
index ff929e60993..be1bdf5ab12 100644
--- a/rust/hw/char/pl011/src/device.rs
+++ b/rust/hw/char/pl011/src/device.rs
@@ -4,7 +4,7 @@
use std::{ffi::CStr, mem::size_of};
-use bql::BqlRefCell;
+use bql::prelude::*;
use chardev::prelude::*;
use common::prelude::*;
use hwcore::{prelude::*, ClockEvent, IRQState};
diff --git a/rust/hw/core/tests/tests.rs b/rust/hw/core/tests/tests.rs
index f38376d0016..e60c9d018f5 100644
--- a/rust/hw/core/tests/tests.rs
+++ b/rust/hw/core/tests/tests.rs
@@ -4,7 +4,7 @@
use std::{ffi::CStr, ptr::addr_of};
-use bql::BqlCell;
+use bql::prelude::*;
use hwcore::prelude::*;
use migration::prelude::*;
use qom::{prelude::*, ObjectImpl, ParentField};
diff --git a/rust/hw/timer/hpet/src/device.rs b/rust/hw/timer/hpet/src/device.rs
index 4ff1779a3d2..b7153a46e31 100644
--- a/rust/hw/timer/hpet/src/device.rs
+++ b/rust/hw/timer/hpet/src/device.rs
@@ -10,7 +10,7 @@
slice::from_ref,
};
-use bql::{BqlCell, BqlRefCell};
+use bql::prelude::*;
use common::prelude::*;
use hwcore::prelude::*;
use migration::{self, prelude::*};
diff --git a/rust/migration/src/migratable.rs b/rust/migration/src/migratable.rs
index ded6fe8f4a6..ce603867502 100644
--- a/rust/migration/src/migratable.rs
+++ b/rust/migration/src/migratable.rs
@@ -9,7 +9,7 @@
sync::{Arc, Mutex},
};
-use bql::{BqlCell, BqlRefCell};
+use bql::prelude::*;
use common::Zeroable;
use crate::{
diff --git a/rust/tests/tests/vmstate_tests.rs b/rust/tests/tests/vmstate_tests.rs
index c3f9e1c7436..87176a80990 100644
--- a/rust/tests/tests/vmstate_tests.rs
+++ b/rust/tests/tests/vmstate_tests.rs
@@ -9,7 +9,7 @@
slice,
};
-use bql::BqlCell;
+use bql::prelude::*;
use common::Opaque;
use migration::{
bindings::{
--
2.51.1
next prev parent reply other threads:[~2025-11-17 7:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-17 7:42 [PATCH 0/8] rust: add preludes to all crates Paolo Bonzini
2025-11-17 7:42 ` [PATCH 1/8] util: add prelude Paolo Bonzini
2025-11-17 7:42 ` [PATCH 2/8] common: " Paolo Bonzini
2025-11-17 7:42 ` [PATCH 3/8] hwcore: " Paolo Bonzini
2025-11-17 7:42 ` [PATCH 4/8] migration: " Paolo Bonzini
2025-11-17 7:42 ` [PATCH 5/8] chardev: " Paolo Bonzini
2025-11-17 7:42 ` Paolo Bonzini [this message]
2025-11-17 7:42 ` [PATCH 7/8] system: " Paolo Bonzini
2025-11-17 7:42 ` [PATCH 8/8] qom: add more to the prelude Paolo Bonzini
2025-11-17 8:03 ` [PATCH 0/8] rust: add preludes to all crates Marc-André Lureau
2025-11-17 8:36 ` Paolo Bonzini
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=20251117074239.190424-7-pbonzini@redhat.com \
--to=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).