docs: fix rustdoc warnings and enforce full API doc coverage

- Wrap in backticks every bare type in rustdoc comments (vertex.rs,
  frame.rs, pipeline_cache.rs, material.rs, mesh.rs, scene.rs, error.rs)
  so rustdoc no longer misreads them as intra-doc links or HTML tags.
- Add a missing doc comment on the public Frame struct.
- Add #![warn(missing_docs)] to the crate root so unevidenced public
  items are surfaced going forward.

cargo doc --no-deps now generates with zero warnings.
This commit is contained in:
Jérôme Bousquié
2026-09-16 09:32:25 +02:00
parent a7b50d9a39
commit d81743481b
8 changed files with 19 additions and 12 deletions
+5 -1
View File
@@ -9,12 +9,16 @@
//! - **context**: provides the Surface from which Frame acquires the current texture.
//! - **renderer**: passes Frame's TextureView to render() as the color attachment target.
//! - **error**: does not use errors directly; Frame::new() panics on acquisition failure while
//! Frame::try_new() returns Option<Self> for graceful recovery.
//! Frame::try_new() returns `Option<Self>` for graceful recovery.
//!
//! ## Architecture Notes (per ARCHI_APP.md)
//! - **Phase d'Exécution**: Frame is acquired at the start of each render loop iteration and released after rendering.
//! - **Ergonomie**: Users interact with frames through Renderer::render() + Renderer::present(), not directly with wgpu handles.
/// A per-frame RAII wrapper around the surface texture and its `TextureView`.
/// Owned for the duration of a single render pass: acquired via `Frame::new()`/`try_new()` at the
/// start of each frame loop iteration, used by `Renderer` as the color attachment target, then
/// dropped after `present()` submits it to the GPU queue.
pub struct Frame {
/// The GPU surface texture representing the current display buffer to be presented.
pub surface_texture: wgpu::SurfaceTexture,
+3
View File
@@ -25,6 +25,9 @@
//! use wsg_lib::utils::BASIC_SHADER;
//! ```
// Warn if a public API item has no rustdoc comment, keeping API coverage at 100%.
#![warn(missing_docs)]
pub mod app;
pub mod core;
pub mod handler;
+1 -1
View File
@@ -198,7 +198,7 @@ impl PipelineCache {
/// Retrieves a cached RenderPipeline by shader_id without creating one.
/// Inputs: shader_id (unique key into the cache).
/// Returns Some(Arc<RenderPipeline>) if found, None otherwise. Called by renderer code for pipeline inspection.
/// Returns Some(`Arc<RenderPipeline>`) if found, None otherwise. Called by renderer code for pipeline inspection.
pub fn get(&self, shader_id: &str) -> Option<&Arc<wgpu::RenderPipeline>> {
self.pipelines.get(shader_id)
}
+1 -1
View File
@@ -6,7 +6,7 @@
//!
//! ## Architecture Notes (per ARCHI_APP.md)
//! - **Identifiants**: Each Material is registered in Scene by string identifier, enabling dynamic access
//! during the render loop without borrow checker issues. The shader_id serves as the Handle<T> key.
//! during the render loop without borrow checker issues. The shader_id serves as the `Handle<T>` key.
//! - **Phase de Déclaration**: Materials are instantiated once in the declarative phase before the render loop begins.
use crate::pipeline::PipelineCache;
+1 -1
View File
@@ -5,7 +5,7 @@
//!
//! ## Architecture Notes (per ARCHI_APP.md)
//! - **Identifiants**: Each Mesh is registered in Scene by string identifier, enabling dynamic access
//! during the render loop without borrow checker issues. The identifier serves as the Handle<T> key.
//! during the render loop without borrow checker issues. The identifier serves as the `Handle<T>` key.
//! - **Phase de Déclaration**: Meshes are instantiated once in the declarative phase before the render loop begins.
//! - **Performance**: Multiple entities can reference the same Mesh, reducing memory footprint for repeated geometry.
+4 -4
View File
@@ -15,13 +15,13 @@
#[repr(C)]
#[derive(Copy, Clone, Debug, bytemuck::Pod, bytemuck::Zeroable)]
pub struct Vertex {
/// XYZ coordinates of this vertex in world space. Offset: 0 bytes (12 bytes total as [f32;3]).
/// XYZ coordinates of this vertex in world space. Offset: 0 bytes (12 bytes total as `[f32; 3]`).
pub position: [f32; 3],
/// XYZ coordinates of the vertex normal. Offset: 12 bytes (12 bytes total as [f32;3]).
/// XYZ coordinates of the vertex normal. Offset: 12 bytes (12 bytes total as `[f32; 3]`).
pub normal: [f32; 3],
/// UV texture coordinates. Offset: 24 bytes (8 bytes total as [f32;2]).
/// UV texture coordinates. Offset: 24 bytes (8 bytes total as `[f32; 2]`).
pub uv: [f32; 2],
/// RGBA color values. Offset: 32 bytes (16 bytes total as [f32;4]).
/// RGBA color values. Offset: 32 bytes (16 bytes total as `[f32; 4]`).
pub color: [f32; 4],
}
+3 -3
View File
@@ -6,7 +6,7 @@
//! ## Architecture Notes (per ARCHI_APP.md)
//! - **La Recette**: Scene is central to the "App" facade workflow. In the Phase de Déclaration, users call add_mesh(), add_material(), and add_entity()
//! to build the resource depot. During Phase d'Exécution, Renderer iterates Scene entities for rendering.
//! - **Identifiants**: All resource registration uses string identifiers (Handle<T>/String pattern), guaranteeing memory safety
//! - **Identifiants**: All resource registration uses string identifiers (`Handle<T>`/String pattern), guaranteeing memory safety
//! and avoiding borrow checker issues during dynamic updates.
//! - **Ergonomie**: Users interact only with entity-level operations (add/remove/get) rather than wgpu buffers/pipelines directly.
@@ -18,9 +18,9 @@ use std::sync::Arc;
/// and maps entity labels to their associated mesh+material pairs for rendering iteration.
/// Created once during application setup; entities are added before the render loop starts.
pub struct Scene {
/// Map of mesh identifiers to owned Arc<Mesh> instances. Populated via `add_mesh()`.
/// Map of mesh identifiers to owned `Arc<Mesh>` instances. Populated via `add_mesh()`.
meshes: HashMap<String, Arc<Mesh>>,
/// Map of material identifiers to owned Arc<Material> instances. Populated via `add_material()`.
/// Map of material identifiers to owned `Arc<Material>` instances. Populated via `add_material()`.
materials: HashMap<String, Arc<Material>>,
/// Map of entity labels to (mesh_id, material_id) associations. Populated via `add_entity()`.
entities: HashMap<String, (String, String)>,
+1 -1
View File
@@ -8,7 +8,7 @@
//! ## Interaction with Other Modules
//! - **context** uses WsgError as return types for `new()`, `configure()`, and `begin_frame()`.
//! - **renderer** does not use errors directly (render panics on invalid state rather than returning Result).
//! - **frame** does not use errors — Frame::new() panics while Frame::try_new() returns Option<Self>.
//! - **frame** does not use errors — Frame::new() panics while Frame::try_new() returns `Option<Self>`.
use thiserror::Error;