Crate wgsldoc

Crate wgsldoc 

Source
Expand description
                     .__       .___             
 __  _  ______  _____|  |    __| _/____   ____  
 \ \/ \/ / ___\/  ___/  |   / __ |/  _ \_/ ___\ 
  \     / /_/  >___ \|  |__/ /_/ (  <_> )  \___ 
   \/\_/\___  /____  >____/\____ |\____/ \___  >
       /_____/     \/           \/           \/  wgsldoc v1.0.0
 

wgsldoc is a documentation generator for WGSL (WebGPU Shading Language) shader modules. It parses .wgsl files, extracts documentation comments, and generates a structured, searchable HTML site for easy browsing and reference.

This documentation contains all the necessary information to get started with wgsldoc, or use it components in your own Rust projects.

§Basic usage

After installation, you can run wgsldoc from the command line. The following command will generate documentation for all WGSL files (including README.md and favicon.png files) in the current directory, outputting the result to the docs directory:

wgsldoc

If you want to host your docs as a website, you should specify a base URL with the -U option:

wgsldoc -U https://example.com/docs

If you want to only generate the AST (Abstract Syntax Tree) and print it to stdout (or another stream) instead of generating full documentation, you can use the -A option:

wgsldoc -A > ast_output.txt

or for stdout

wgsldoc -A

More advanced usage:

Usage: wgsldoc [OPTIONS]

Options:
  -N, --name <NAME>              Name of the package to generate documentation for
  -D, --target-dir <TARGET_DIR>  Target directory for the generated documentation 
  -U, --base-url <BASE_URL>      Base URL for future website. If specified, it will be used to generate links in the documentation. Otherwise, the links will use `target_dir` as the base URL
  -A, --ast-only                 Generate AST and print it to stdout instead of generating full documentation
  -I, --input <FILES>            Input files to process. If not specified, the program will look for .wgsl files in the current directory
  -W, --show-undocumented        Show undocumented items in the documentation
  -C, --credits                  Show credits
  -h, --help                     Print help (see more with '--help')
  -V, --version                  Print version

Modules§

cli
Command-line interface module for the documentation generator. Defines the structure for parsing command-line arguments using the clap crate.
generator
Documentation generator module. Contains traits and implementations for generating documentation from parsed WGSL shader modules.
models
Models module containing data structures for representing WGSL components. This components are used throughout the application for parsing, processing, and generating documentation. This includes:
parser
WGSL parser module. Parses WGSL shader code into Rust structures, representing various shader module elements like functions, structures, bindings, constants, and imports.
utils
Module containing utility functions and types for the documentation generator.

Macros§

impl_eq_name
Implements PartialEq, Eq and Hash for a type based on a single field (usually component name).

Structs§

Document
Represents a WGSL document used for generating documentation static website. It contains package name, favicon, README content, file registry, and parsed shaders. Must be “registered” using Document::register method before generating documentation, creating a RegisteredDocument invariant.
RegisteredDocument
Represents a registered WGSL document ready for documentation generation. This struct is created by calling the Document::register method, ensuring that all imports are resolved and the document is prepared.

Type Aliases§

IconData
Type alias for raw icon data (favicon).