8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
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
+
11
18
use std:: fmt;
12
19
use std:: local_data;
13
20
use std:: rt:: io;
@@ -19,8 +26,13 @@ use clean;
19
26
use html:: render;
20
27
use html:: render:: { cache_key, current_location_key} ;
21
28
29
+ /// Helper to render an optional visibility with a space after it (if the
30
+ /// visibility is preset)
22
31
pub struct VisSpace ( Option < ast:: visibility > ) ;
32
+ /// Similarly to VisSpace, this structure is used to render a purity with a
33
+ /// space after it.
23
34
pub struct PuritySpace ( ast:: purity ) ;
35
+ /// Wrapper struct for properly emitting a method declaration.
24
36
pub struct Method < ' self > ( & ' self clean:: SelfTy , & ' self clean:: FnDecl ) ;
25
37
26
38
impl fmt:: Default for clean:: Generics {
@@ -98,6 +110,8 @@ impl fmt::Default for clean::Path {
98
110
}
99
111
}
100
112
113
+ /// Used when rendering a `ResolvedPath` structure. This invokes the `path`
114
+ /// rendering function with the necessary arguments for linking to a local path.
101
115
fn resolved_path ( w : & mut io:: Writer , id : ast:: NodeId , p : & clean:: Path ,
102
116
print_all : bool ) {
103
117
path ( w, p, print_all,
@@ -115,6 +129,8 @@ fn resolved_path(w: &mut io::Writer, id: ast::NodeId, p: &clean::Path,
115
129
} ) ;
116
130
}
117
131
132
+ /// Used when rendering an `ExternalPath` structure. Like `resolved_path` this
133
+ /// will invoke `path` with proper linking-style arguments.
118
134
fn external_path ( w : & mut io:: Writer , p : & clean:: Path , print_all : bool ,
119
135
fqn : & [ ~str ] , kind : clean:: TypeKind , crate : ast:: CrateNum ) {
120
136
path ( w, p, print_all,
@@ -230,6 +246,7 @@ fn path(w: &mut io::Writer, path: &clean::Path, print_all: bool,
230
246
}
231
247
}
232
248
249
+ /// Helper to render type parameters
233
250
fn typarams ( w : & mut io:: Writer , typarams : & Option < ~[ clean:: TyParamBound ] > ) {
234
251
match * typarams {
235
252
Some ( ref params) => {
0 commit comments