rust: qemu_api: add a documentation header for all modules
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 30 Jan 2025 10:11:18 +0000 (11:11 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 13 Feb 2025 11:51:34 +0000 (12:51 +0100)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
rust/qemu-api/src/assertions.rs
rust/qemu-api/src/bindings.rs
rust/qemu-api/src/c_str.rs
rust/qemu-api/src/offset_of.rs
rust/qemu-api/src/prelude.rs
rust/qemu-api/src/sysbus.rs
rust/qemu-api/src/zeroable.rs

index 6e420469806eb847764305b2a3bd1e34263ca43d..fa1a18de6fe961d158674cad7a867878591ec7b5 100644 (file)
@@ -2,9 +2,13 @@
 // Author(s): Paolo Bonzini <pbonzini@redhat.com>
 // SPDX-License-Identifier: GPL-2.0-or-later
 
+#![doc(hidden)]
 //! This module provides macros to check the equality of types and
 //! the type of `struct` fields.  This can be useful to ensure that
 //! types match the expectations of C code.
+//!
+//! Documentation is hidden because it only exposes macros, which
+//! are exported directly from `qemu_api`.
 
 // Based on https://stackoverflow.com/questions/64251852/x/70978292#70978292
 // (stackoverflow answers are released under MIT license).
index b71220113ef59f7abfdb8ba96226aaf2a18eac59..d2868639ff6031d77812d7d4fc1f7478f04f5c70 100644 (file)
@@ -15,6 +15,8 @@
     clippy::missing_safety_doc
 )]
 
+//! `bindgen`-generated declarations.
+
 #[cfg(MESON)]
 include!("bindings.inc.rs");
 
index 4cd96da0b45df029e513acce8846f855e75ea2cf..3fa61b59c768054f2e16966e1630f999c44c8cab 100644 (file)
@@ -2,6 +2,14 @@
 // Author(s): Paolo Bonzini <pbonzini@redhat.com>
 // SPDX-License-Identifier: GPL-2.0-or-later
 
+#![doc(hidden)]
+//! This module provides a macro to define a constant of type
+//! [`CStr`](std::ffi::CStr), for compatibility with versions of
+//! Rust that lack `c""` literals.
+//!
+//! Documentation is hidden because it only exposes macros, which
+//! are exported directly from `qemu_api`.
+
 #[macro_export]
 /// Given a string constant _without_ embedded or trailing NULs, return
 /// a `CStr`.
index 075e98f986ba9bbc9cb4c16b2d38a2d751a54f18..373229bbde96f26ca1197fe5362c1aeaf9a4e0f2 100644 (file)
@@ -1,5 +1,12 @@
 // SPDX-License-Identifier: MIT
 
+#![doc(hidden)]
+//! This module provides macros that emulate the functionality of
+//! `core::mem::offset_of` on older versions of Rust.
+//!
+//! Documentation is hidden because it only exposes macros, which
+//! are exported directly from `qemu_api`.
+
 /// This macro provides the same functionality as `core::mem::offset_of`,
 /// except that only one level of field access is supported.  The declaration
 /// of the struct must be wrapped with `with_offsets! { }`.
index 254edb476dd11b5e27d1dabcf0f55b9c6de0b7b0..fbf0ee23e0b9b34eaf7c78f6903292f6fed26bc9 100644 (file)
@@ -2,6 +2,8 @@
 // Author(s): Paolo Bonzini <pbonzini@redhat.com>
 // SPDX-License-Identifier: GPL-2.0-or-later
 
+//! Commonly used traits and types for QEMU.
+
 pub use crate::bitops::IntegerExt;
 
 pub use crate::cell::BqlCell;
index 1f66a5f1e0947d2cbe89b4af345ad33607077816..fa36e12178f185ecd75592c98269c325aaeb7b9d 100644 (file)
@@ -2,6 +2,8 @@
 // Author(s): Paolo Bonzini <pbonzini@redhat.com>
 // SPDX-License-Identifier: GPL-2.0-or-later
 
+//! Bindings to access `sysbus` functionality from Rust.
+
 use std::{ffi::CStr, ptr::addr_of_mut};
 
 pub use bindings::{SysBusDevice, SysBusDeviceClass};
index cd424e6ea050edf3187dda89d62e95f28e0ab568..a2356cb2f24cbed520cc41a56c06d816c47d291c 100644 (file)
@@ -1,5 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 
+//! Defines a trait for structs that can be safely initialized with zero bytes.
+
 /// Encapsulates the requirement that
 /// `MaybeUninit::<Self>::zeroed().assume_init()` does not cause undefined
 /// behavior.  This trait in principle could be implemented as just: