88// option. This file may not be copied, modified, or distributed
99// except according to those terms.
1010
11+ //! HTML formatting module
12+ //!
13+ //! This module contains a large number of `fmt::Default` implementations for
14+ //! various types in `rustdoc::clean`. These implementations all currently
15+ //! assume that HTML output is desired, although it may be possible to redesign
16+ //! them in the future to instead emit any format desired.
17+
1118use std:: fmt;
1219use std:: local_data;
1320use std:: rt:: io;
@@ -19,8 +26,13 @@ use clean;
1926use html:: render;
2027use html:: render:: { cache_key, current_location_key} ;
2128
29+ /// Helper to render an optional visibility with a space after it (if the
30+ /// visibility is preset)
2231pub struct VisSpace ( Option < ast:: visibility > ) ;
32+ /// Similarly to VisSpace, this structure is used to render a purity with a
33+ /// space after it.
2334pub struct PuritySpace ( ast:: purity ) ;
35+ /// Wrapper struct for properly emitting a method declaration.
2436pub struct Method < ' self > ( & ' self clean:: SelfTy , & ' self clean:: FnDecl ) ;
2537
2638impl fmt:: Default for clean:: Generics {
@@ -98,6 +110,8 @@ impl fmt::Default for clean::Path {
98110 }
99111}
100112
113+ /// Used when rendering a `ResolvedPath` structure. This invokes the `path`
114+ /// rendering function with the necessary arguments for linking to a local path.
101115fn resolved_path ( w : & mut io:: Writer , id : ast:: NodeId , p : & clean:: Path ,
102116 print_all : bool ) {
103117 path ( w, p, print_all,
@@ -115,6 +129,8 @@ fn resolved_path(w: &mut io::Writer, id: ast::NodeId, p: &clean::Path,
115129 } ) ;
116130}
117131
132+ /// Used when rendering an `ExternalPath` structure. Like `resolved_path` this
133+ /// will invoke `path` with proper linking-style arguments.
118134fn external_path ( w : & mut io:: Writer , p : & clean:: Path , print_all : bool ,
119135 fqn : & [ ~str ] , kind : clean:: TypeKind , crate : ast:: CrateNum ) {
120136 path ( w, p, print_all,
@@ -230,6 +246,7 @@ fn path(w: &mut io::Writer, path: &clean::Path, print_all: bool,
230246 }
231247}
232248
249+ /// Helper to render type parameters
233250fn typarams ( w : & mut io:: Writer , typarams : & Option < ~[ clean:: TyParamBound ] > ) {
234251 match * typarams {
235252 Some ( ref params) => {
0 commit comments