rustdoc: Put fn docs inside fn bodies
This commit is contained in:
parent
9191911499
commit
810af2dada
3 changed files with 11 additions and 5 deletions
|
@ -24,12 +24,14 @@ type arg_attrs = {
|
||||||
desc: str
|
desc: str
|
||||||
};
|
};
|
||||||
|
|
||||||
#[doc =
|
|
||||||
"Given a vec of attributes, extract the meta_items contained in the \
|
|
||||||
doc attribute"]
|
|
||||||
fn doc_meta(
|
fn doc_meta(
|
||||||
attrs: [ast::attribute]
|
attrs: [ast::attribute]
|
||||||
) -> option<@ast::meta_item> {
|
) -> option<@ast::meta_item> {
|
||||||
|
|
||||||
|
#[doc =
|
||||||
|
"Given a vec of attributes, extract the meta_items contained in the \
|
||||||
|
doc attribute"];
|
||||||
|
|
||||||
let doc_attrs = attr::find_attrs_by_name(attrs, "doc");
|
let doc_attrs = attr::find_attrs_by_name(attrs, "doc");
|
||||||
let doc_metas = attr::attr_metas(doc_attrs);
|
let doc_metas = attr::attr_metas(doc_attrs);
|
||||||
if vec::is_not_empty(doc_metas) {
|
if vec::is_not_empty(doc_metas) {
|
||||||
|
|
|
@ -4,11 +4,13 @@ import rustc::syntax::ast;
|
||||||
|
|
||||||
export from_srv, extract;
|
export from_srv, extract;
|
||||||
|
|
||||||
#[doc = "Use the AST service to create a document tree"]
|
|
||||||
fn from_srv(
|
fn from_srv(
|
||||||
srv: astsrv::srv,
|
srv: astsrv::srv,
|
||||||
default_name: str
|
default_name: str
|
||||||
) -> doc::cratedoc {
|
) -> doc::cratedoc {
|
||||||
|
|
||||||
|
#[doc = "Use the AST service to create a document tree"];
|
||||||
|
|
||||||
astsrv::exec(srv) {|ctxt|
|
astsrv::exec(srv) {|ctxt|
|
||||||
extract(ctxt.ast, default_name)
|
extract(ctxt.ast, default_name)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,14 @@
|
||||||
#[doc = "A single operation on the document model"]
|
#[doc = "A single operation on the document model"]
|
||||||
type pass = fn~(srv: astsrv::srv, doc: doc::cratedoc) -> doc::cratedoc;
|
type pass = fn~(srv: astsrv::srv, doc: doc::cratedoc) -> doc::cratedoc;
|
||||||
|
|
||||||
#[doc = "Run a series of passes over the document"]
|
|
||||||
fn run_passes(
|
fn run_passes(
|
||||||
srv: astsrv::srv,
|
srv: astsrv::srv,
|
||||||
doc: doc::cratedoc,
|
doc: doc::cratedoc,
|
||||||
passes: [pass]
|
passes: [pass]
|
||||||
) -> doc::cratedoc {
|
) -> doc::cratedoc {
|
||||||
|
|
||||||
|
#[doc = "Run a series of passes over the document"];
|
||||||
|
|
||||||
vec::foldl(doc, passes) {|doc, pass|
|
vec::foldl(doc, passes) {|doc, pass|
|
||||||
pass(srv, doc)
|
pass(srv, doc)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue