Skip to content

Instantly share code, notes, and snippets.

@brson
Created January 19, 2012 07:12
Show Gist options
  • Save brson/1638542 to your computer and use it in GitHub Desktop.
Save brson/1638542 to your computer and use it in GitHub Desktop.

Crate rustdoc

Rustdoc - The Rust documentation generator

Function run_passes

Run a series of passes over the document

Arguments:

  • srv: astsrv::srv - The AST service to provide to the passes
  • doc: doc::cratedoc - The document to transform
  • passes: [pass] - The list of passes used to transform the document

Returns doc::cratedoc

Function run

Runs rustdoc over the given file

Arguments:

  • source_file: str

Module parse

AST-parsing helpers

Module extract

Converts the Rust AST to the rustdoc document model

Function from_srv

Use the AST service to create a document tree

Arguments:

  • srv: astsrv::srv
  • default_name: str

Returns doc::cratedoc

Module attr_parser

Attribute parsing

The attribute parser provides methods for pulling documentation out of an AST's attributes.

Function doc_meta

Given a vec of attributes, extract the meta_items contained in the doc attribute

Arguments:

  • attrs: [ast::attribute]

Returns option<@ast::meta_item>

Module doc

The document model

Module gen

Generate markdown from a document tree

Module fold

Module attr_pass

The attribute parsing pass

Traverses the document tree, pulling relevant documention out of the corresponding AST nodes. The information gathered here is the basis of the natural-language documentation for a crate.

Module tystr_pass

Pulls type information out of the AST and attaches it to the document

Module prune_undoc_pass

Prunes branches of the document tree that contain no documentation

Module astsrv

Provides all access to AST-related, non-sendable info

Rustdoc is intended to be parallel, and the rustc AST is filled with shared boxes. The AST service attempts to provide a single place to query AST-related information, shielding the rest of Rustdoc from its non-sendableness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment