add declaration blocks to attribute/derive pages
This commit is contained in:
parent
8f69a82513
commit
869ebc4f95
1 changed files with 18 additions and 4 deletions
|
@ -4611,10 +4611,24 @@ fn item_macro(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
|
||||||
fn item_proc_macro(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, m: &clean::ProcMacro)
|
fn item_proc_macro(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, m: &clean::ProcMacro)
|
||||||
-> fmt::Result
|
-> fmt::Result
|
||||||
{
|
{
|
||||||
if m.kind == MacroKind::Bang {
|
let name = it.name.as_ref().expect("proc-macros always have names");
|
||||||
write!(w, "<pre class='rust macro'>")?;
|
match m.kind {
|
||||||
write!(w, "{}!() {{ /* proc-macro */ }}", it.name.as_ref().unwrap())?;
|
MacroKind::Bang => {
|
||||||
write!(w, "</pre>")?;
|
write!(w, "<pre class='rust macro'>")?;
|
||||||
|
write!(w, "{}!() {{ /* proc-macro */ }}", name)?;
|
||||||
|
write!(w, "</pre>")?;
|
||||||
|
}
|
||||||
|
MacroKind::Attr => {
|
||||||
|
write!(w, "<pre class='rust attr'>")?;
|
||||||
|
write!(w, "#[{}]", name)?;
|
||||||
|
write!(w, "</pre>")?;
|
||||||
|
}
|
||||||
|
MacroKind::Derive => {
|
||||||
|
write!(w, "<pre class='rust derive'>")?;
|
||||||
|
write!(w, "#[derive({})]", name)?;
|
||||||
|
write!(w, "</pre>")?;
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
document(w, cx, it)
|
document(w, cx, it)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue