AllTypes to function
This commit is contained in:
parent
17bef30d0b
commit
a502e85603
1 changed files with 30 additions and 32 deletions
|
@ -1757,8 +1757,7 @@ impl AllTypes {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_entries(f: &mut fmt::Formatter<'_>, e: &FxHashSet<ItemEntry>, title: &str,
|
fn print_entries(f: &mut Buffer, e: &FxHashSet<ItemEntry>, title: &str, class: &str) {
|
||||||
class: &str) -> fmt::Result {
|
|
||||||
if !e.is_empty() {
|
if !e.is_empty() {
|
||||||
let mut e: Vec<&ItemEntry> = e.iter().collect();
|
let mut e: Vec<&ItemEntry> = e.iter().collect();
|
||||||
e.sort();
|
e.sort();
|
||||||
|
@ -1766,39 +1765,38 @@ fn print_entries(f: &mut fmt::Formatter<'_>, e: &FxHashSet<ItemEntry>, title: &s
|
||||||
title,
|
title,
|
||||||
Escape(title),
|
Escape(title),
|
||||||
class,
|
class,
|
||||||
e.iter().map(|s| format!("<li>{}</li>", s)).collect::<String>())?;
|
e.iter().map(|s| format!("<li>{}</li>", s)).collect::<String>());
|
||||||
}
|
}
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for AllTypes {
|
impl AllTypes {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn print(self, f: &mut Buffer) {
|
||||||
write!(f,
|
write!(f,
|
||||||
"<h1 class='fqn'>\
|
"<h1 class='fqn'>\
|
||||||
<span class='out-of-band'>\
|
<span class='out-of-band'>\
|
||||||
<span id='render-detail'>\
|
<span id='render-detail'>\
|
||||||
<a id=\"toggle-all-docs\" href=\"javascript:void(0)\" title=\"collapse all docs\">\
|
<a id=\"toggle-all-docs\" href=\"javascript:void(0)\" title=\"collapse all docs\">\
|
||||||
[<span class='inner'>−</span>]\
|
[<span class='inner'>−</span>]\
|
||||||
</a>\
|
</a>\
|
||||||
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
<span class='in-band'>List of all items</span>\
|
||||||
<span class='in-band'>List of all items</span>\
|
</h1>");
|
||||||
</h1>")?;
|
print_entries(f, &self.structs, "Structs", "structs");
|
||||||
print_entries(f, &self.structs, "Structs", "structs")?;
|
print_entries(f, &self.enums, "Enums", "enums");
|
||||||
print_entries(f, &self.enums, "Enums", "enums")?;
|
print_entries(f, &self.unions, "Unions", "unions");
|
||||||
print_entries(f, &self.unions, "Unions", "unions")?;
|
print_entries(f, &self.primitives, "Primitives", "primitives");
|
||||||
print_entries(f, &self.primitives, "Primitives", "primitives")?;
|
print_entries(f, &self.traits, "Traits", "traits");
|
||||||
print_entries(f, &self.traits, "Traits", "traits")?;
|
print_entries(f, &self.macros, "Macros", "macros");
|
||||||
print_entries(f, &self.macros, "Macros", "macros")?;
|
print_entries(f, &self.attributes, "Attribute Macros", "attributes");
|
||||||
print_entries(f, &self.attributes, "Attribute Macros", "attributes")?;
|
print_entries(f, &self.derives, "Derive Macros", "derives");
|
||||||
print_entries(f, &self.derives, "Derive Macros", "derives")?;
|
print_entries(f, &self.functions, "Functions", "functions");
|
||||||
print_entries(f, &self.functions, "Functions", "functions")?;
|
print_entries(f, &self.typedefs, "Typedefs", "typedefs");
|
||||||
print_entries(f, &self.typedefs, "Typedefs", "typedefs")?;
|
print_entries(f, &self.trait_aliases, "Trait Aliases", "trait-aliases");
|
||||||
print_entries(f, &self.trait_aliases, "Trait Aliases", "trait-aliases")?;
|
print_entries(f, &self.opaque_tys, "Opaque Types", "opaque-types");
|
||||||
print_entries(f, &self.opaque_tys, "Opaque Types", "opaque-types")?;
|
print_entries(f, &self.statics, "Statics", "statics");
|
||||||
print_entries(f, &self.statics, "Statics", "statics")?;
|
print_entries(f, &self.constants, "Constants", "constants")
|
||||||
print_entries(f, &self.constants, "Constants", "constants")
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn settings(root_path: &str, suffix: &str) -> String {
|
fn settings(root_path: &str, suffix: &str) -> String {
|
||||||
|
@ -1901,7 +1899,7 @@ impl Context {
|
||||||
String::new()
|
String::new()
|
||||||
};
|
};
|
||||||
let v = layout::render(&self.shared.layout,
|
let v = layout::render(&self.shared.layout,
|
||||||
&page, sidebar, |buf: &mut Buffer| buf.from_display(all),
|
&page, sidebar, |buf: &mut Buffer| all.print(buf),
|
||||||
&self.shared.themes);
|
&self.shared.themes);
|
||||||
self.shared.fs.write(&final_file, v.as_bytes())?;
|
self.shared.fs.write(&final_file, v.as_bytes())?;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue