Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
aca1bd7d
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,发现更多精彩内容 >>
提交
aca1bd7d
编写于
11月 15, 2017
作者:
G
Guillaume Gomez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
First step for important traits UI
上级
be68d34a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
61 addition
and
14 deletion
+61
-14
src/librustdoc/html/render.rs
src/librustdoc/html/render.rs
+14
-13
src/librustdoc/html/static/main.js
src/librustdoc/html/static/main.js
+16
-1
src/librustdoc/html/static/rustdoc.css
src/librustdoc/html/static/rustdoc.css
+31
-0
未找到文件。
src/librustdoc/html/render.rs
浏览文件 @
aca1bd7d
...
...
@@ -1816,8 +1816,7 @@ fn plain_summary_line(s: Option<&str>) -> String {
fn
document
(
w
:
&
mut
fmt
::
Formatter
,
cx
:
&
Context
,
item
:
&
clean
::
Item
)
->
fmt
::
Result
{
document_stability
(
w
,
cx
,
item
)
?
;
let
mut
prefix
=
render_assoc_const_value
(
item
);
prefix
.push_str
(
&
render_spotlight_traits
(
item
)
?
);
let
prefix
=
render_assoc_const_value
(
item
);
document_full
(
w
,
item
,
cx
,
&
prefix
)
?
;
Ok
(())
}
...
...
@@ -2267,10 +2266,15 @@ fn item_function(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
AbiSpace
(
f
.abi
),
it
.name
.as_ref
()
.unwrap
(),
f
.generics
)
.len
();
let
mut
extra
=
render_spotlight_traits
(
it
)
?
;
if
!
extra
.is_empty
()
{
extra
.insert_str
(
0
,
"<div class=
\"
important-traits
\"
>ⓘ<div class=
\"
content hidden
\"
>"
);
extra
.push_str
(
"</div></div>"
);
};
write!
(
w
,
"<pre class='rust fn'>"
)
?
;
render_attributes
(
w
,
it
)
?
;
write!
(
w
,
"{vis}{constness}{unsafety}{abi}fn
\
{name}{generics}{decl}{where_clause}</pre>"
,
{name}{generics}{decl}{where_clause}</pre>
{extra}
"
,
vis
=
VisSpace
(
&
it
.visibility
),
constness
=
ConstnessSpace
(
f
.constness
),
unsafety
=
UnsafetySpace
(
f
.unsafety
),
...
...
@@ -2282,7 +2286,8 @@ fn item_function(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
decl
:
&
f
.decl
,
name_len
,
indent
:
0
,
})
?
;
},
extra
=
extra
)
?
;
document
(
w
,
cx
,
it
)
}
...
...
@@ -3266,7 +3271,7 @@ fn spotlight_decl(decl: &clean::FnDecl) -> Result<String, fmt::Error> {
if
out
.is_empty
()
{
out
.push_str
(
"<span class=
\"
docblock autohide
\"
>"
);
out
.push_str
(
&
format!
(
"<h3>Important traits for {}</h3>"
,
impl_
.for_
));
out
.push_str
(
"<code class=
\"
spotligh
t
\"
>"
);
out
.push_str
(
"<code class=
\"
conten
t
\"
>"
);
}
//use the "where" class here to make it small
...
...
@@ -3287,7 +3292,8 @@ fn spotlight_decl(decl: &clean::FnDecl) -> Result<String, fmt::Error> {
}
if
!
out
.is_empty
()
{
out
.push_str
(
"</code></span>"
);
out
.insert_str
(
0
,
"<div class=
\"
important-traits
\"
>ⓘ<div class=
\"
content hidden
\"
>"
);
out
.push_str
(
"</code></span></div></div>"
);
}
Ok
(
out
)
...
...
@@ -3327,7 +3333,6 @@ fn doc_impl_item(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item,
trait_
:
Option
<&
clean
::
Trait
>
,
show_def_docs
:
bool
)
->
fmt
::
Result
{
let
item_type
=
item
.type_
();
let
name
=
item
.name
.as_ref
()
.unwrap
();
let
mut
method_prefix
:
Option
<
String
>
=
None
;
let
render_method_item
:
bool
=
match
render_mode
{
RenderMode
::
Normal
=>
true
,
...
...
@@ -3342,6 +3347,7 @@ fn doc_impl_item(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item,
let
id
=
derive_id
(
format!
(
"{}.{}"
,
item_type
,
name
));
let
ns_id
=
derive_id
(
format!
(
"{}.{}"
,
name
,
item_type
.name_space
()));
write!
(
w
,
"<h4 id='{}' class=
\"
{}
\"
>"
,
id
,
item_type
)
?
;
write!
(
w
,
"{}"
,
spotlight_decl
(
decl
)
?
)
?
;
write!
(
w
,
"<span id='{}' class='invisible'>"
,
ns_id
)
?
;
write!
(
w
,
"<code>"
)
?
;
render_assoc_item
(
w
,
item
,
link
.anchor
(
&
id
),
ItemType
::
Impl
)
?
;
...
...
@@ -3356,7 +3362,6 @@ fn doc_impl_item(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item,
render_stability_since_raw
(
w
,
item
.stable_since
(),
outer_version
)
?
;
}
write!
(
w
,
"</span></h4>
\n
"
)
?
;
method_prefix
=
Some
(
spotlight_decl
(
decl
)
?
);
}
}
clean
::
TypedefItem
(
ref
tydef
,
_
)
=>
{
...
...
@@ -3388,11 +3393,7 @@ fn doc_impl_item(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item,
}
if
render_method_item
||
render_mode
==
RenderMode
::
Normal
{
let
mut
prefix
=
render_assoc_const_value
(
item
);
if
let
Some
(
method_prefix
)
=
method_prefix
{
prefix
.push_str
(
&
method_prefix
);
}
let
prefix
=
render_assoc_const_value
(
item
);
if
!
is_default_item
{
if
let
Some
(
t
)
=
trait_
{
...
...
src/librustdoc/html/static/main.js
浏览文件 @
aca1bd7d
...
...
@@ -1624,7 +1624,9 @@
}
onEach
(
document
.
getElementById
(
'
main
'
).
getElementsByClassName
(
'
docblock
'
),
function
(
e
)
{
e
.
parentNode
.
insertBefore
(
createToggle
(),
e
);
if
(
e
.
parentNode
.
id
===
"
main
"
)
{
e
.
parentNode
.
insertBefore
(
createToggle
(),
e
);
}
});
onEach
(
document
.
getElementsByClassName
(
'
docblock
'
),
function
(
e
)
{
...
...
@@ -1711,6 +1713,19 @@
}
});
function
showModal
(
content
)
{
var
modal
=
document
.
createElement
(
'
div
'
);
addClass
(
modal
,
'
modal
'
);
modal
.
innerHTML
=
'
<div class="modal-content">
'
+
content
+
"
</div>
"
;
document
.
getElementsByTagName
(
'
body
'
)[
0
].
appendChild
(
modal
);
}
onEach
(
document
.
getElementsByClassName
(
'
important-traits
'
),
function
(
e
)
{
e
.
onclick
=
function
()
{
showModal
(
e
.
firstElementChild
.
innerHTML
);
};
});
var
search_input
=
document
.
getElementsByClassName
(
"
search-input
"
)[
0
];
if
(
search_input
)
{
...
...
src/librustdoc/html/static/rustdoc.css
浏览文件 @
aca1bd7d
...
...
@@ -954,3 +954,34 @@ pre.rust {
color
:
#888
;
font-size
:
16px
;
}
h4
>
.important-traits
{
position
:
absolute
;
left
:
-44px
;
top
:
2px
;
cursor
:
pointer
;
}
.modal
{
position
:
fixed
;
width
:
100vw
;
height
:
100vh
;
background-color
:
rgba
(
0
,
0
,
0
,
0.3
);
z-index
:
10000
;
top
:
0
;
left
:
0
;
}
.modal-content
{
display
:
block
;
max-width
:
60%
;
min-width
:
200px
;
background-color
:
white
;
padding
:
5px
;
top
:
10%
;
position
:
absolute
;
left
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
border
:
1px
solid
#999
;
border-radius
:
4px
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录