}
/// Metadata about implementations for a type or trait.
-#[derive(Clone)]
+#[derive(Clone, Debug)]
pub struct Impl {
pub impl_item: clean::Item,
}
render_assoc_items(w, cx, it, it.def_id, AssocItemRender::All)?;
let cache = cache();
- let impl_header = "
- <h2 id='implementors' class='small-section-header'>
- Implementors<a href='#implementors' class='anchor'></a>
- </h2>
- <ul class='item-list' id='implementors-list'>
+ let impl_header = "\
+ <h2 id='implementors' class='small-section-header'>\
+ Implementors<a href='#implementors' class='anchor'></a>\
+ </h2>\
+ <ul class='item-list' id='implementors-list'>\
";
- let synthetic_impl_header = "
- <h2 id='synthetic-implementors' class='small-section-header'>
- Auto implementors<a href='#synthetic-implementors' class='anchor'></a>
- </h2>
- <ul class='item-list' id='synthetic-implementors-list'>
+ let synthetic_impl_header = "\
+ <h2 id='synthetic-implementors' class='small-section-header'>\
+ Auto implementors<a href='#synthetic-implementors' class='anchor'></a>\
+ </h2>\
+ <ul class='item-list' id='synthetic-implementors-list'>\
";
let mut synthetic_types = Vec::new();
.map_or(true, |d| cache.paths.contains_key(&d)));
- let (synthetic, concrete) = local.iter()
- .partition::<Vec<_>, _>(|i| i.inner_impl().synthetic);
-
+ let (synthetic, concrete): (Vec<&&Impl>, Vec<&&Impl>) = local.iter()
+ .filter(|i| i.inner_impl().blanket_impl.is_none())
+ .partition(|i| i.inner_impl().synthetic);
if !foreign.is_empty() {
write!(w, "
render_deref_methods(w, cx, impl_, containing_item, has_deref_mut)?;
}
- let (synthetic, concrete) = traits
+ let (synthetic, concrete): (Vec<&&Impl>, Vec<&&Impl>) = traits
.iter()
- .partition::<Vec<_>, _>(|t| t.inner_impl().synthetic);
+ .partition(|t| t.inner_impl().synthetic);
+ let (blanket_impl, concrete) = concrete
+ .into_iter()
+ .partition(|t| t.inner_impl().blanket_impl.is_some());
struct RendererStruct<'a, 'b, 'c>(&'a Context, Vec<&'b &'b Impl>, &'c clean::Item);
render_impls(cx, w, &synthetic, containing_item)?;
write!(w, "</div>")?;
}
+
+ if !blanket_impl.is_empty() {
+ write!(w, "\
+ <h2 id='blanket-implementations' class='small-section-header'>\
+ Blanket Implementations\
+ <a href='#blanket-implementations' class='anchor'></a>\
+ </h2>\
+ <div id='blanket-implementations-list'>\
+ ")?;
+ render_impls(cx, w, &blanket_impl, containing_item)?;
+ write!(w, "</div>")?;
+ }
}
Ok(())
}
.collect::<String>()
};
- let (synthetic, concrete) = v
+ let (synthetic, concrete): (Vec<&Impl>, Vec<&Impl>) = v
.iter()
.partition::<Vec<_>, _>(|i| i.inner_impl().synthetic);
+ let (blanket_impl, concrete): (Vec<&Impl>, Vec<&Impl>) = concrete
+ .into_iter()
+ .partition::<Vec<_>, _>(|i| i.inner_impl().blanket_impl.is_some());
let concrete_format = format_impls(concrete);
let synthetic_format = format_impls(synthetic);
+ let blanket_format = format_impls(blanket_impl);
if !concrete_format.is_empty() {
out.push_str("<a class=\"sidebar-title\" href=\"#implementations\">\
Auto Trait Implementations</a>");
out.push_str(&format!("<div class=\"sidebar-links\">{}</div>", synthetic_format));
}
+
+ if !blanket_format.is_empty() {
+ out.push_str("<a class=\"sidebar-title\" href=\"#blanket-implementations\">\
+ Blanket Implementations</a>");
+ out.push_str(&format!("<div class=\"sidebar-links\">{}</div>", blanket_format));
+ }
}
}