mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-29 11:37:39 +00:00
Make portability part of the summary.
That means it will be visible under "Implementors" on trait pages, and under "Implementations" on struct/enum pages, even when all methods are collapsed. Switch to a float layout for rightside elements.
This commit is contained in:
parent
910c7fa767
commit
593d6d1cb1
@ -1552,6 +1552,7 @@ fn render_impl(
|
|||||||
w,
|
w,
|
||||||
cx,
|
cx,
|
||||||
i,
|
i,
|
||||||
|
parent,
|
||||||
outer_version,
|
outer_version,
|
||||||
outer_const_version,
|
outer_const_version,
|
||||||
show_def_docs,
|
show_def_docs,
|
||||||
@ -1562,11 +1563,6 @@ fn render_impl(
|
|||||||
if toggled {
|
if toggled {
|
||||||
write!(w, "</summary>")
|
write!(w, "</summary>")
|
||||||
}
|
}
|
||||||
if trait_.is_some() {
|
|
||||||
if let Some(portability) = portability(&i.impl_item, Some(parent)) {
|
|
||||||
write!(w, "<div class=\"item-info\">{}</div>", portability);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(ref dox) = cx.shared.maybe_collapsed_doc_value(&i.impl_item) {
|
if let Some(ref dox) = cx.shared.maybe_collapsed_doc_value(&i.impl_item) {
|
||||||
let mut ids = cx.id_map.borrow_mut();
|
let mut ids = cx.id_map.borrow_mut();
|
||||||
@ -1598,6 +1594,7 @@ pub(crate) fn render_impl_summary(
|
|||||||
w: &mut Buffer,
|
w: &mut Buffer,
|
||||||
cx: &Context<'_>,
|
cx: &Context<'_>,
|
||||||
i: &Impl,
|
i: &Impl,
|
||||||
|
parent: &clean::Item,
|
||||||
outer_version: Option<&str>,
|
outer_version: Option<&str>,
|
||||||
outer_const_version: Option<&str>,
|
outer_const_version: Option<&str>,
|
||||||
show_def_docs: bool,
|
show_def_docs: bool,
|
||||||
@ -1652,6 +1649,7 @@ pub(crate) fn render_impl_summary(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
write!(w, "<a href=\"#{}\" class=\"anchor\"></a>", id);
|
write!(w, "<a href=\"#{}\" class=\"anchor\"></a>", id);
|
||||||
|
write!(w, "<div class=\"rightside\">");
|
||||||
render_stability_since_raw(
|
render_stability_since_raw(
|
||||||
w,
|
w,
|
||||||
i.impl_item.stable_since(tcx).as_deref(),
|
i.impl_item.stable_since(tcx).as_deref(),
|
||||||
@ -1660,6 +1658,15 @@ pub(crate) fn render_impl_summary(
|
|||||||
outer_const_version,
|
outer_const_version,
|
||||||
);
|
);
|
||||||
write_srclink(cx, &i.impl_item, w);
|
write_srclink(cx, &i.impl_item, w);
|
||||||
|
w.write_str("</div>"); // end of "rightside"
|
||||||
|
|
||||||
|
let is_trait = i.inner_impl().trait_.is_some();
|
||||||
|
if is_trait {
|
||||||
|
if let Some(portability) = portability(&i.impl_item, Some(parent)) {
|
||||||
|
write!(w, "<div class=\"item-info\">{}</div>", portability);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
w.write_str("</div>");
|
w.write_str("</div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,11 +585,14 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
|
|||||||
if toggled {
|
if toggled {
|
||||||
write!(w, "<details class=\"rustdoc-toggle\" open><summary>");
|
write!(w, "<details class=\"rustdoc-toggle\" open><summary>");
|
||||||
}
|
}
|
||||||
write!(w, "<div id=\"{}\" class=\"method has-srclink\"><code>", id);
|
write!(w, "<div id=\"{}\" class=\"method has-srclink\">", id);
|
||||||
render_assoc_item(w, m, AssocItemLink::Anchor(Some(&id)), ItemType::Impl, cx);
|
write!(w, "<div class=\"rightside\">");
|
||||||
w.write_str("</code>");
|
|
||||||
render_stability_since(w, m, t, cx.tcx());
|
render_stability_since(w, m, t, cx.tcx());
|
||||||
write_srclink(cx, m, w);
|
write_srclink(cx, m, w);
|
||||||
|
write!(w, "</div>");
|
||||||
|
write!(w, "<code>");
|
||||||
|
render_assoc_item(w, m, AssocItemLink::Anchor(Some(&id)), ItemType::Impl, cx);
|
||||||
|
w.write_str("</code>");
|
||||||
w.write_str("</div>");
|
w.write_str("</div>");
|
||||||
if toggled {
|
if toggled {
|
||||||
write!(w, "</summary>");
|
write!(w, "</summary>");
|
||||||
@ -697,6 +700,7 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
|
|||||||
w,
|
w,
|
||||||
cx,
|
cx,
|
||||||
&implementor,
|
&implementor,
|
||||||
|
it,
|
||||||
outer_version.as_deref(),
|
outer_version.as_deref(),
|
||||||
outer_const_version.as_deref(),
|
outer_const_version.as_deref(),
|
||||||
false,
|
false,
|
||||||
@ -1305,7 +1309,7 @@ fn render_implementor(
|
|||||||
implementor_dups: &FxHashMap<Symbol, (DefId, bool)>,
|
implementor_dups: &FxHashMap<Symbol, (DefId, bool)>,
|
||||||
aliases: &[String],
|
aliases: &[String],
|
||||||
) {
|
) {
|
||||||
// If there's already another implementor that has the same abbridged name, use the
|
// If there's already another implementor that has the same abridged name, use the
|
||||||
// full path, for example in `std::iter::ExactSizeIterator`
|
// full path, for example in `std::iter::ExactSizeIterator`
|
||||||
let use_absolute = match implementor.inner_impl().for_ {
|
let use_absolute = match implementor.inner_impl().for_ {
|
||||||
clean::ResolvedPath { ref path, is_generic: false, .. }
|
clean::ResolvedPath { ref path, is_generic: false, .. }
|
||||||
@ -1321,6 +1325,7 @@ fn render_implementor(
|
|||||||
w,
|
w,
|
||||||
cx,
|
cx,
|
||||||
implementor,
|
implementor,
|
||||||
|
trait_,
|
||||||
outer_version.as_deref(),
|
outer_version.as_deref(),
|
||||||
outer_const_version.as_deref(),
|
outer_const_version.as_deref(),
|
||||||
false,
|
false,
|
||||||
|
@ -581,7 +581,6 @@ nav.sub {
|
|||||||
.content .item-info {
|
.content .item-info {
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-left: 33px;
|
margin-left: 33px;
|
||||||
margin-top: -13px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.sub-variant > div > .item-info {
|
.sub-variant > div > .item-info {
|
||||||
@ -852,12 +851,12 @@ body.blur > :not(#help) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.stab {
|
.stab {
|
||||||
display: table;
|
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
font-size: 90%;
|
font-size: 90%;
|
||||||
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
.stab p {
|
.stab p {
|
||||||
display: inline;
|
display: inline;
|
||||||
@ -906,26 +905,22 @@ body.blur > :not(#help) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.impl-items .since, .impl .since, .methods .since {
|
.impl-items .since, .impl .since, .methods .since {
|
||||||
flex-grow: 0;
|
|
||||||
padding-left: 12px;
|
padding-left: 12px;
|
||||||
padding-right: 2px;
|
padding-right: 2px;
|
||||||
position: initial;
|
position: initial;
|
||||||
}
|
}
|
||||||
|
|
||||||
.impl-items .srclink, .impl .srclink, .methods .srclink {
|
.impl-items .srclink, .impl .srclink, .methods .srclink {
|
||||||
flex-grow: 0;
|
|
||||||
/* Override header settings otherwise it's too bold */
|
/* Override header settings otherwise it's too bold */
|
||||||
font-size: 17px;
|
font-size: 17px;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
.impl-items code, .impl code, .methods code {
|
.rightside {
|
||||||
flex-grow: 1;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.has-srclink {
|
.has-srclink {
|
||||||
display: flex;
|
|
||||||
flex-basis: 100%;
|
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
/* Push the src link out to the right edge consistently */
|
/* Push the src link out to the right edge consistently */
|
||||||
@ -986,7 +981,6 @@ a.test-arrow:hover{
|
|||||||
}
|
}
|
||||||
|
|
||||||
.since + .srclink {
|
.since + .srclink {
|
||||||
display: table-cell;
|
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
// @has foo/struct.Unsized.html
|
// @has foo/struct.Unsized.html
|
||||||
// @has - '//div[@id="impl-Sized"]/code' 'impl !Sized for Unsized'
|
// @has - '//div[@id="impl-Sized"]/code' 'impl !Sized for Unsized'
|
||||||
// @!has - '//div[@id="impl-Sized"]/a[@class="srclink"]' '[src]'
|
// @!has - '//div[@id="impl-Sized"]//a[@class="srclink"]' '[src]'
|
||||||
// @has - '//div[@id="impl-Sync"]/code' 'impl Sync for Unsized'
|
// @has - '//div[@id="impl-Sync"]/code' 'impl Sync for Unsized'
|
||||||
// @!has - '//div[@id="impl-Sync"]/a[@class="srclink"]' '[src]'
|
// @!has - '//div[@id="impl-Sync"]//a[@class="srclink"]' '[src]'
|
||||||
// @has - '//div[@id="impl-Any"]/code' 'impl<T> Any for T'
|
// @has - '//div[@id="impl-Any"]/code' 'impl<T> Any for T'
|
||||||
// @has - '//div[@id="impl-Any"]/a[@class="srclink"]' '[src]'
|
// @has - '//div[@id="impl-Any"]//a[@class="srclink"]' '[src]'
|
||||||
pub struct Unsized {
|
pub struct Unsized {
|
||||||
data: [u8],
|
data: [u8],
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user