1
Fork 0

Add links for impls

Implements a solution for issue #23552
This commit is contained in:
Jouan Amate 2017-08-18 09:38:52 -07:00
parent 1b08e0f231
commit c8d58a306e
3 changed files with 11 additions and 4 deletions

View file

@ -2925,7 +2925,13 @@ fn render_deref_methods(w: &mut fmt::Formatter, cx: &Context, impl_: &Impl,
fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLink, fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLink,
render_mode: RenderMode, outer_version: Option<&str>) -> fmt::Result { render_mode: RenderMode, outer_version: Option<&str>) -> fmt::Result {
if render_mode == RenderMode::Normal { if render_mode == RenderMode::Normal {
write!(w, "<h3 class='impl'><span class='in-band'><code>{}</code>", i.inner_impl())?; let id = derive_id(match i.inner_impl().trait_ {
Some(ref t) => format!("impl-{}", Escape(&format!("{:#}", t))),
None => "impl".to_string(),
});
write!(w, "<h3 id='{}' class='impl'><span class='in-band'><code>{}</code>",
id, i.inner_impl())?;
write!(w, "<a href='#{}' class='anchor'></a>", id)?;
write!(w, "</span><span class='out-of-band'>")?; write!(w, "</span><span class='out-of-band'>")?;
let since = i.impl_item.stability.as_ref().map(|s| &s.since[..]); let since = i.impl_item.stability.as_ref().map(|s| &s.since[..]);
if let Some(l) = (Item { item: &i.impl_item, cx: cx }).src_href() { if let Some(l) = (Item { item: &i.impl_item, cx: cx }).src_href() {

View file

@ -441,6 +441,10 @@ a {
.small-section-header:hover > .anchor { .small-section-header:hover > .anchor {
display: initial; display: initial;
} }
.in-band:hover > .anchor {
display: initial;
}
.anchor { .anchor {
display: none; display: none;
} }

View file

@ -26,9 +26,6 @@ h1.fqn {
h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type):not(.tymethod) { h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type):not(.tymethod) {
border-bottom-color: #DDDDDD; border-bottom-color: #DDDDDD;
} }
.in-band {
background-color: white;
}
.docblock code, .docblock-short code { .docblock code, .docblock-short code {
background-color: #F5F5F5; background-color: #F5F5F5;