Skip to content

Commit 35d3213

Browse files
authored
Fix the doc warning attribute and document remaining items for bevy_window (#9933)
# Objective Complete the documentation for `bevy_window`. ## Solution The `warn(missing_doc)` attribute was only applying to the `cursor` module as it was declared as an inner attribute. I switched it to an outer attribute and documented the remaining items.
1 parent df899d2 commit 35d3213

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

crates/bevy_window/src/event.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ pub struct WindowMoved {
313313
pub position: IVec2,
314314
}
315315

316-
/// An event sent when system changed window theme.
316+
/// An event sent when the system theme changes for a window.
317317
///
318318
/// This event is only sent when the window is relying on the system theme to control its appearance.
319319
/// i.e. It is only sent when [`Window::window_theme`](crate::window::Window::window_theme) is `None` and the system theme changes.
@@ -325,6 +325,8 @@ pub struct WindowMoved {
325325
reflect(Serialize, Deserialize)
326326
)]
327327
pub struct WindowThemeChanged {
328+
/// Window for which the system theme has changed.
328329
pub window: Entity,
330+
/// The new system theme.
329331
pub theme: WindowTheme,
330332
}

crates/bevy_window/src/lib.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
#![allow(clippy::type_complexity)]
2+
#![warn(missing_docs)]
3+
//! `bevy_window` provides a platform-agnostic interface for windowing in Bevy.
4+
//!
5+
//! This crate contains types for window management and events,
6+
//! used by windowing implementors such as `bevy_winit`.
7+
//! The [`WindowPlugin`] sets up some global window-related parameters and
8+
//! is part of the [`DefaultPlugins`](https://docs.rs/bevy/latest/bevy/struct.DefaultPlugins.html).
29
3-
#[warn(missing_docs)]
410
mod cursor;
511
mod event;
612
mod raw_handle;
@@ -14,6 +20,7 @@ pub use event::*;
1420
pub use system::*;
1521
pub use window::*;
1622

23+
#[allow(missing_docs)]
1724
pub mod prelude {
1825
#[doc(hidden)]
1926
pub use crate::{

crates/bevy_window/src/raw_handle.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ use raw_window_handle::{
1010
/// thread-safe.
1111
#[derive(Debug, Clone, Component)]
1212
pub struct RawHandleWrapper {
13+
/// Raw handle to a window.
1314
pub window_handle: RawWindowHandle,
15+
/// Raw handle to the display server.
1416
pub display_handle: RawDisplayHandle,
1517
}
1618

@@ -24,14 +26,6 @@ impl RawHandleWrapper {
2426
pub unsafe fn get_handle(&self) -> ThreadLockedRawWindowHandleWrapper {
2527
ThreadLockedRawWindowHandleWrapper(self.clone())
2628
}
27-
28-
pub fn get_display_handle(&self) -> RawDisplayHandle {
29-
self.display_handle
30-
}
31-
32-
pub fn get_window_handle(&self) -> RawWindowHandle {
33-
self.window_handle
34-
}
3529
}
3630

3731
// SAFETY: [`RawHandleWrapper`] is just a normal "raw pointer", which doesn't impl Send/Sync. However the pointer is only
@@ -59,7 +53,7 @@ pub struct ThreadLockedRawWindowHandleWrapper(RawHandleWrapper);
5953
// and so exposing a safe method to get a [`RawWindowHandle`] directly would be UB.
6054
unsafe impl HasRawWindowHandle for ThreadLockedRawWindowHandleWrapper {
6155
fn raw_window_handle(&self) -> RawWindowHandle {
62-
self.0.get_window_handle()
56+
self.0.window_handle
6357
}
6458
}
6559

@@ -71,6 +65,6 @@ unsafe impl HasRawWindowHandle for ThreadLockedRawWindowHandleWrapper {
7165
// and so exposing a safe method to get a [`RawDisplayHandle`] directly would be UB.
7266
unsafe impl HasRawDisplayHandle for ThreadLockedRawWindowHandleWrapper {
7367
fn raw_display_handle(&self) -> RawDisplayHandle {
74-
self.0.get_display_handle()
68+
self.0.display_handle
7569
}
7670
}

0 commit comments

Comments
 (0)