Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
061d345c
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,发现更多精彩内容 >>
提交
061d345c
编写于
10月 23, 2018
作者:
M
Mazdak Farrokhzad
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
constify parts of liballoc.
上级
5b89877d
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
21 addition
and
21 deletion
+21
-21
src/liballoc/collections/binary_heap.rs
src/liballoc/collections/binary_heap.rs
+1
-1
src/liballoc/collections/btree/map.rs
src/liballoc/collections/btree/map.rs
+2
-2
src/liballoc/collections/btree/node.rs
src/liballoc/collections/btree/node.rs
+1
-1
src/liballoc/collections/btree/set.rs
src/liballoc/collections/btree/set.rs
+2
-2
src/liballoc/collections/linked_list.rs
src/liballoc/collections/linked_list.rs
+6
-6
src/liballoc/collections/vec_deque.rs
src/liballoc/collections/vec_deque.rs
+2
-2
src/liballoc/raw_vec.rs
src/liballoc/raw_vec.rs
+2
-2
src/liballoc/string.rs
src/liballoc/string.rs
+3
-3
src/liballoc/vec.rs
src/liballoc/vec.rs
+2
-2
未找到文件。
src/liballoc/collections/binary_heap.rs
浏览文件 @
061d345c
...
...
@@ -884,7 +884,7 @@ unsafe fn new(data: &'a mut [T], pos: usize) -> Self {
}
#[inline]
fn
pos
(
&
self
)
->
usize
{
const
fn
pos
(
&
self
)
->
usize
{
self
.pos
}
...
...
src/liballoc/collections/btree/map.rs
浏览文件 @
061d345c
...
...
@@ -2074,7 +2074,7 @@ pub fn values_mut(&mut self) -> ValuesMut<K, V> {
/// assert_eq!(a.len(), 1);
/// ```
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
len
(
&
self
)
->
usize
{
pub
const
fn
len
(
&
self
)
->
usize
{
self
.length
}
...
...
@@ -2093,7 +2093,7 @@ pub fn len(&self) -> usize {
/// assert!(!a.is_empty());
/// ```
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
is_empty
(
&
self
)
->
bool
{
pub
const
fn
is_empty
(
&
self
)
->
bool
{
self
.len
()
==
0
}
}
...
...
src/liballoc/collections/btree/node.rs
浏览文件 @
061d345c
...
...
@@ -357,7 +357,7 @@ pub fn len(&self) -> usize {
/// Returns the height of this node in the whole tree. Zero height denotes the
/// leaf level.
pub
fn
height
(
&
self
)
->
usize
{
pub
const
fn
height
(
&
self
)
->
usize
{
self
.height
}
...
...
src/liballoc/collections/btree/set.rs
浏览文件 @
061d345c
...
...
@@ -730,7 +730,7 @@ pub fn iter(&self) -> Iter<T> {
/// assert_eq!(v.len(), 1);
/// ```
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
len
(
&
self
)
->
usize
{
pub
const
fn
len
(
&
self
)
->
usize
{
self
.map
.len
()
}
...
...
@@ -747,7 +747,7 @@ pub fn len(&self) -> usize {
/// assert!(!v.is_empty());
/// ```
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
is_empty
(
&
self
)
->
bool
{
pub
const
fn
is_empty
(
&
self
)
->
bool
{
self
.len
()
==
0
}
}
...
...
src/liballoc/collections/linked_list.rs
浏览文件 @
061d345c
...
...
@@ -135,7 +135,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
}
impl
<
T
>
Node
<
T
>
{
fn
new
(
element
:
T
)
->
Self
{
const
fn
new
(
element
:
T
)
->
Self
{
Node
{
next
:
None
,
prev
:
None
,
...
...
@@ -264,7 +264,7 @@ impl<T> LinkedList<T> {
/// ```
#[inline]
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
new
()
->
Self
{
pub
const
fn
new
()
->
Self
{
LinkedList
{
head
:
None
,
tail
:
None
,
...
...
@@ -341,7 +341,7 @@ pub fn append(&mut self, other: &mut Self) {
/// ```
#[inline]
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
iter
(
&
self
)
->
Iter
<
T
>
{
pub
const
fn
iter
(
&
self
)
->
Iter
<
T
>
{
Iter
{
head
:
self
.head
,
tail
:
self
.tail
,
...
...
@@ -401,8 +401,8 @@ pub fn iter_mut(&mut self) -> IterMut<T> {
/// ```
#[inline]
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
is_empty
(
&
self
)
->
bool
{
self
.
head
.is_none
()
pub
const
fn
is_empty
(
&
self
)
->
bool
{
self
.
len
()
==
0
}
/// Returns the length of the `LinkedList`.
...
...
@@ -427,7 +427,7 @@ pub fn is_empty(&self) -> bool {
/// ```
#[inline]
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
len
(
&
self
)
->
usize
{
pub
const
fn
len
(
&
self
)
->
usize
{
self
.len
}
...
...
src/liballoc/collections/vec_deque.rs
浏览文件 @
061d345c
...
...
@@ -933,7 +933,7 @@ pub fn len(&self) -> usize {
/// assert!(!v.is_empty());
/// ```
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
is_empty
(
&
self
)
->
bool
{
pub
const
fn
is_empty
(
&
self
)
->
bool
{
self
.tail
==
self
.head
}
...
...
@@ -1275,7 +1275,7 @@ pub fn pop_back(&mut self) -> Option<T> {
}
#[inline]
fn
is_contiguous
(
&
self
)
->
bool
{
const
fn
is_contiguous
(
&
self
)
->
bool
{
self
.tail
<=
self
.head
}
...
...
src/liballoc/raw_vec.rs
浏览文件 @
061d345c
...
...
@@ -204,7 +204,7 @@ impl<T, A: Alloc> RawVec<T, A> {
/// Gets a raw pointer to the start of the allocation. Note that this is
/// Unique::empty() if `cap = 0` or T is zero-sized. In the former case, you must
/// be careful.
pub
fn
ptr
(
&
self
)
->
*
mut
T
{
pub
const
fn
ptr
(
&
self
)
->
*
mut
T
{
self
.ptr
.as_ptr
()
}
...
...
@@ -221,7 +221,7 @@ pub fn cap(&self) -> usize {
}
/// Returns a shared reference to the allocator backing this RawVec.
pub
fn
alloc
(
&
self
)
->
&
A
{
pub
const
fn
alloc
(
&
self
)
->
&
A
{
&
self
.a
}
...
...
src/liballoc/string.rs
浏览文件 @
061d345c
...
...
@@ -1374,7 +1374,7 @@ pub unsafe fn as_mut_vec(&mut self) -> &mut Vec<u8> {
/// ```
#[inline]
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
len
(
&
self
)
->
usize
{
pub
const
fn
len
(
&
self
)
->
usize
{
self
.vec
.len
()
}
...
...
@@ -1395,7 +1395,7 @@ pub fn len(&self) -> usize {
/// ```
#[inline]
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
is_empty
(
&
self
)
->
bool
{
pub
const
fn
is_empty
(
&
self
)
->
bool
{
self
.len
()
==
0
}
...
...
@@ -1662,7 +1662,7 @@ pub fn into_bytes(self) -> Vec<u8> {
/// assert_eq!(1, error.valid_up_to());
/// ```
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
utf8_error
(
&
self
)
->
Utf8Error
{
pub
const
fn
utf8_error
(
&
self
)
->
Utf8Error
{
self
.error
}
}
...
...
src/liballoc/vec.rs
浏览文件 @
061d345c
...
...
@@ -1165,7 +1165,7 @@ pub fn clear(&mut self) {
/// ```
#[inline]
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
len
(
&
self
)
->
usize
{
pub
const
fn
len
(
&
self
)
->
usize
{
self
.len
}
...
...
@@ -1181,7 +1181,7 @@ pub fn len(&self) -> usize {
/// assert!(!v.is_empty());
/// ```
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
is_empty
(
&
self
)
->
bool
{
pub
const
fn
is_empty
(
&
self
)
->
bool
{
self
.len
()
==
0
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录