Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
ae644a2d
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ae644a2d
编写于
11月 18, 2020
作者:
N
Nixon Enraght-Moony
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add [src] links to methods on a trait's page
上级
b491587c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
43 addition
and
24 deletion
+43
-24
src/librustdoc/html/render/mod.rs
src/librustdoc/html/render/mod.rs
+12
-19
src/librustdoc/html/static/rustdoc.css
src/librustdoc/html/static/rustdoc.css
+5
-5
src/test/rustdoc/trait-src-link.rs
src/test/rustdoc/trait-src-link.rs
+26
-0
未找到文件。
src/librustdoc/html/render/mod.rs
浏览文件 @
ae644a2d
...
...
@@ -86,11 +86,7 @@
crate
fn
ensure_trailing_slash
(
v
:
&
str
)
->
impl
fmt
::
Display
+
'_
{
crate
::
html
::
format
::
display_fn
(
move
|
f
|
{
if
!
v
.ends_with
(
'/'
)
&&
!
v
.is_empty
()
{
write!
(
f
,
"{}/"
,
v
)
}
else
{
write!
(
f
,
"{}"
,
v
)
}
if
!
v
.ends_with
(
'/'
)
&&
!
v
.is_empty
()
{
write!
(
f
,
"{}/"
,
v
)
}
else
{
write!
(
f
,
"{}"
,
v
)
}
})
}
...
...
@@ -1950,11 +1946,7 @@ fn document_stability(
}
fn
document_non_exhaustive_header
(
item
:
&
clean
::
Item
)
->
&
str
{
if
item
.is_non_exhaustive
()
{
" (Non-exhaustive)"
}
else
{
""
}
if
item
.is_non_exhaustive
()
{
" (Non-exhaustive)"
}
else
{
""
}
}
fn
document_non_exhaustive
(
w
:
&
mut
Buffer
,
item
:
&
clean
::
Item
)
{
...
...
@@ -2636,7 +2628,7 @@ fn write_loading_content(w: &mut Buffer, extra_content: &str) {
write!
(
w
,
"{}<span class=
\"
loading-content
\"
>Loading content...</span>"
,
extra_content
)
}
fn
trait_item
(
w
:
&
mut
Buffer
,
cx
:
&
Context
,
m
:
&
clean
::
Item
,
t
:
&
clean
::
Item
)
{
fn
trait_item
(
w
:
&
mut
Buffer
,
cx
:
&
Context
,
m
:
&
clean
::
Item
,
t
:
&
clean
::
Item
,
cache
:
&
Cache
)
{
let
name
=
m
.name
.as_ref
()
.unwrap
();
info!
(
"Documenting {} on {}"
,
name
,
t
.name
.as_deref
()
.unwrap_or_default
());
let
item_type
=
m
.type_
();
...
...
@@ -2645,6 +2637,7 @@ fn trait_item(w: &mut Buffer, cx: &Context, m: &clean::Item, t: &clean::Item) {
render_assoc_item
(
w
,
m
,
AssocItemLink
::
Anchor
(
Some
(
&
id
)),
ItemType
::
Impl
);
write!
(
w
,
"</code>"
);
render_stability_since
(
w
,
m
,
t
);
write_srclink
(
cx
,
m
,
w
,
cache
);
write!
(
w
,
"</h3>"
);
document
(
w
,
cx
,
m
,
Some
(
t
));
}
...
...
@@ -2656,8 +2649,8 @@ fn trait_item(w: &mut Buffer, cx: &Context, m: &clean::Item, t: &clean::Item) {
"Associated Types"
,
"<div class=
\"
methods
\"
>"
,
);
for
t
in
&
types
{
trait_item
(
w
,
cx
,
*
t
,
it
);
for
t
in
types
{
trait_item
(
w
,
cx
,
t
,
it
,
cache
);
}
write_loading_content
(
w
,
"</div>"
);
}
...
...
@@ -2669,8 +2662,8 @@ fn trait_item(w: &mut Buffer, cx: &Context, m: &clean::Item, t: &clean::Item) {
"Associated Constants"
,
"<div class=
\"
methods
\"
>"
,
);
for
t
in
&
consts
{
trait_item
(
w
,
cx
,
*
t
,
it
);
for
t
in
consts
{
trait_item
(
w
,
cx
,
t
,
it
,
cache
);
}
write_loading_content
(
w
,
"</div>"
);
}
...
...
@@ -2683,8 +2676,8 @@ fn trait_item(w: &mut Buffer, cx: &Context, m: &clean::Item, t: &clean::Item) {
"Required methods"
,
"<div class=
\"
methods
\"
>"
,
);
for
m
in
&
required
{
trait_item
(
w
,
cx
,
*
m
,
it
);
for
m
in
required
{
trait_item
(
w
,
cx
,
m
,
it
,
cache
);
}
write_loading_content
(
w
,
"</div>"
);
}
...
...
@@ -2695,8 +2688,8 @@ fn trait_item(w: &mut Buffer, cx: &Context, m: &clean::Item, t: &clean::Item) {
"Provided methods"
,
"<div class=
\"
methods
\"
>"
,
);
for
m
in
&
provided
{
trait_item
(
w
,
cx
,
*
m
,
it
);
for
m
in
provided
{
trait_item
(
w
,
cx
,
m
,
it
,
cache
);
}
write_loading_content
(
w
,
"</div>"
);
}
...
...
src/librustdoc/html/static/rustdoc.css
浏览文件 @
ae644a2d
...
...
@@ -659,7 +659,7 @@ a {
text-decoration
:
underline
;
}
.invisible
>
.srclink
,
h4
>
code
+
.srclink
{
.invisible
>
.srclink
,
h4
>
code
+
.srclink
,
h3
>
code
+
.srclink
{
position
:
absolute
;
top
:
0
;
right
:
0
;
...
...
@@ -857,25 +857,25 @@ body.blur > :not(#help) {
top
:
0
;
}
.impl-items
.since
,
.impl
.since
{
.impl-items
.since
,
.impl
.since
,
.methods
.since
{
flex-grow
:
0
;
padding-left
:
12px
;
padding-right
:
2px
;
position
:
initial
;
}
.impl-items
.srclink
,
.impl
.srclink
{
.impl-items
.srclink
,
.impl
.srclink
,
.methods
.srclink
{
flex-grow
:
0
;
/* Override header settings otherwise it's too bold */
font-size
:
17px
;
font-weight
:
normal
;
}
.impl-items
code
,
.impl
code
{
.impl-items
code
,
.impl
code
,
.methods
code
{
flex-grow
:
1
;
}
.impl-items
h4
,
h4
.impl
,
h3
.impl
{
.impl-items
h4
,
h4
.impl
,
h3
.impl
,
.methods
h3
{
display
:
flex
;
flex-basis
:
100%
;
font-size
:
16px
;
...
...
src/test/rustdoc/trait-src-link.rs
0 → 100644
浏览文件 @
ae644a2d
#![crate_name
=
"quix"
]
pub
trait
Foo
{
// @has quix/trait.Foo.html '//a[@href="../src/quix/trait-src-link.rs.html#4"]' '[src]'
fn
required
();
// @has quix/trait.Foo.html '//a[@href="../src/quix/trait-src-link.rs.html#7"]' '[src]'
fn
provided
()
{}
}
pub
struct
Bar
;
impl
Foo
for
Bar
{
// @has quix/struct.Bar.html '//a[@href="../src/quix/trait-src-link.rs.html#14"]' '[src]'
fn
required
()
{}
// @has quix/struct.Bar.html '//a[@href="../src/quix/trait-src-link.rs.html#7"]' '[src]'
}
pub
struct
Baz
;
impl
Foo
for
Baz
{
// @has quix/struct.Baz.html '//a[@href="../src/quix/trait-src-link.rs.html#22"]' '[src]'
fn
required
()
{}
// @has quix/struct.Baz.html '//a[@href="../src/quix/trait-src-link.rs.html#25"]' '[src]'
fn
provided
()
{}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录