Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
f65b630d
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,发现更多精彩内容 >>
提交
f65b630d
编写于
10月 23, 2018
作者:
M
Mazdak Farrokhzad
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
constify parts of libstd.
上级
061d345c
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
52 addition
and
53 deletion
+52
-53
src/libcore/time.rs
src/libcore/time.rs
+0
-0
src/libstd/collections/hash/map.rs
src/libstd/collections/hash/map.rs
+3
-3
src/libstd/collections/hash/table.rs
src/libstd/collections/hash/table.rs
+6
-6
src/libstd/ffi/c_str.rs
src/libstd/ffi/c_str.rs
+5
-5
src/libstd/io/buffered.rs
src/libstd/io/buffered.rs
+1
-1
src/libstd/io/cursor.rs
src/libstd/io/cursor.rs
+3
-3
src/libstd/io/mod.rs
src/libstd/io/mod.rs
+5
-5
src/libstd/io/util.rs
src/libstd/io/util.rs
+2
-2
src/libstd/net/addr.rs
src/libstd/net/addr.rs
+2
-2
src/libstd/net/ip.rs
src/libstd/net/ip.rs
+3
-4
src/libstd/path.rs
src/libstd/path.rs
+4
-4
src/libstd/process.rs
src/libstd/process.rs
+3
-3
src/libstd/sync/condvar.rs
src/libstd/sync/condvar.rs
+1
-1
src/libstd/sync/mpsc/mod.rs
src/libstd/sync/mpsc/mod.rs
+3
-3
src/libstd/sync/mpsc/oneshot.rs
src/libstd/sync/mpsc/oneshot.rs
+1
-1
src/libstd/sync/once.rs
src/libstd/sync/once.rs
+1
-1
src/libstd/sys_common/mutex.rs
src/libstd/sys_common/mutex.rs
+1
-1
src/libstd/sys_common/net.rs
src/libstd/sys_common/net.rs
+3
-3
src/libstd/sys_common/wtf8.rs
src/libstd/sys_common/wtf8.rs
+2
-2
src/libstd/thread/mod.rs
src/libstd/thread/mod.rs
+2
-2
src/libstd/time.rs
src/libstd/time.rs
+1
-1
未找到文件。
src/libcore/time.rs
100755 → 100644
浏览文件 @
f65b630d
文件模式从 100755 更改为 100644
src/libstd/collections/hash/map.rs
浏览文件 @
f65b630d
...
...
@@ -36,7 +36,7 @@
impl
DefaultResizePolicy
{
#[inline]
fn
new
()
->
DefaultResizePolicy
{
const
fn
new
()
->
DefaultResizePolicy
{
DefaultResizePolicy
}
...
...
@@ -69,7 +69,7 @@ fn raw_capacity(&self, len: usize) -> usize {
/// The capacity of the given raw capacity.
#[inline]
fn
capacity
(
&
self
,
raw_cap
:
usize
)
->
usize
{
const
fn
capacity
(
&
self
,
raw_cap
:
usize
)
->
usize
{
// This doesn't have to be checked for overflow since allocation size
// in bytes will overflow earlier than multiplication by 10.
//
...
...
@@ -3013,7 +3013,7 @@ impl<'a, K: 'a, V: 'a> VacantEntry<'a, K, V> {
/// assert_eq!(map.entry("poneyland").key(), &"poneyland");
/// ```
#[stable(feature
=
"map_entry_keys"
,
since
=
"1.10.0"
)]
pub
fn
key
(
&
self
)
->
&
K
{
pub
const
fn
key
(
&
self
)
->
&
K
{
&
self
.key
}
...
...
src/libstd/collections/hash/table.rs
浏览文件 @
f65b630d
...
...
@@ -247,7 +247,7 @@ unsafe fn hash_pair(&self) -> (*mut HashUint, *mut (K, V)) {
// Buckets hold references to the table.
impl
<
K
,
V
,
M
>
FullBucket
<
K
,
V
,
M
>
{
/// Borrow a reference to the table.
pub
fn
table
(
&
self
)
->
&
M
{
pub
const
fn
table
(
&
self
)
->
&
M
{
&
self
.table
}
/// Borrow a mutable reference to the table.
...
...
@@ -259,18 +259,18 @@ pub fn into_table(self) -> M {
self
.table
}
/// Get the raw index.
pub
fn
index
(
&
self
)
->
usize
{
pub
const
fn
index
(
&
self
)
->
usize
{
self
.raw.idx
}
/// Get the raw bucket.
pub
fn
raw
(
&
self
)
->
RawBucket
<
K
,
V
>
{
pub
const
fn
raw
(
&
self
)
->
RawBucket
<
K
,
V
>
{
self
.raw
}
}
impl
<
K
,
V
,
M
>
EmptyBucket
<
K
,
V
,
M
>
{
/// Borrow a reference to the table.
pub
fn
table
(
&
self
)
->
&
M
{
pub
const
fn
table
(
&
self
)
->
&
M
{
&
self
.table
}
/// Borrow a mutable reference to the table.
...
...
@@ -281,7 +281,7 @@ pub fn table_mut(&mut self) -> &mut M {
impl
<
K
,
V
,
M
>
Bucket
<
K
,
V
,
M
>
{
/// Get the raw index.
pub
fn
index
(
&
self
)
->
usize
{
pub
const
fn
index
(
&
self
)
->
usize
{
self
.raw.idx
}
/// get the table.
...
...
@@ -772,7 +772,7 @@ pub fn capacity(&self) -> usize {
/// The number of elements ever `put` in the hashtable, minus the number
/// of elements ever `take`n.
pub
fn
size
(
&
self
)
->
usize
{
pub
const
fn
size
(
&
self
)
->
usize
{
self
.size
}
...
...
src/libstd/ffi/c_str.rs
浏览文件 @
f65b630d
...
...
@@ -265,12 +265,12 @@ enum FromBytesWithNulErrorKind {
}
impl
FromBytesWithNulError
{
fn
interior_nul
(
pos
:
usize
)
->
FromBytesWithNulError
{
const
fn
interior_nul
(
pos
:
usize
)
->
FromBytesWithNulError
{
FromBytesWithNulError
{
kind
:
FromBytesWithNulErrorKind
::
InteriorNul
(
pos
),
}
}
fn
not_nul_terminated
()
->
FromBytesWithNulError
{
const
fn
not_nul_terminated
()
->
FromBytesWithNulError
{
FromBytesWithNulError
{
kind
:
FromBytesWithNulErrorKind
::
NotNulTerminated
,
}
...
...
@@ -833,7 +833,7 @@ impl NulError {
/// assert_eq!(nul_error.nul_position(), 7);
/// ```
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
nul_position
(
&
self
)
->
usize
{
self
.0
}
pub
const
fn
nul_position
(
&
self
)
->
usize
{
self
.0
}
/// Consumes this error, returning the underlying vector of bytes which
/// generated the error in the first place.
...
...
@@ -909,7 +909,7 @@ pub fn into_cstring(self) -> CString {
/// Access the underlying UTF-8 error that was the cause of this error.
#[stable(feature
=
"cstring_into"
,
since
=
"1.7.0"
)]
pub
fn
utf8_error
(
&
self
)
->
Utf8Error
{
pub
const
fn
utf8_error
(
&
self
)
->
Utf8Error
{
self
.error
}
}
...
...
@@ -1091,7 +1091,7 @@ pub fn from_bytes_with_nul(bytes: &[u8])
/// [`CString`]: struct.CString.html
#[inline]
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
as_ptr
(
&
self
)
->
*
const
c_char
{
pub
const
fn
as_ptr
(
&
self
)
->
*
const
c_char
{
self
.inner
.as_ptr
()
}
...
...
src/libstd/io/buffered.rs
浏览文件 @
f65b630d
...
...
@@ -633,7 +633,7 @@ impl<W> IntoInnerError<W> {
/// };
/// ```
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
error
(
&
self
)
->
&
Error
{
&
self
.1
}
pub
const
fn
error
(
&
self
)
->
&
Error
{
&
self
.1
}
/// Returns the buffered writer instance which generated the error.
///
...
...
src/libstd/io/cursor.rs
浏览文件 @
f65b630d
...
...
@@ -104,7 +104,7 @@ impl<T> Cursor<T> {
/// # force_inference(&buff);
/// ```
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
new
(
inner
:
T
)
->
Cursor
<
T
>
{
pub
const
fn
new
(
inner
:
T
)
->
Cursor
<
T
>
{
Cursor
{
pos
:
0
,
inner
:
inner
}
}
...
...
@@ -138,7 +138,7 @@ pub fn into_inner(self) -> T { self.inner }
/// let reference = buff.get_ref();
/// ```
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
get_ref
(
&
self
)
->
&
T
{
&
self
.inner
}
pub
const
fn
get_ref
(
&
self
)
->
&
T
{
&
self
.inner
}
/// Gets a mutable reference to the underlying value in this cursor.
///
...
...
@@ -179,7 +179,7 @@ pub fn get_mut(&mut self) -> &mut T { &mut self.inner }
/// assert_eq!(buff.position(), 1);
/// ```
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
position
(
&
self
)
->
u64
{
self
.pos
}
pub
const
fn
position
(
&
self
)
->
u64
{
self
.pos
}
/// Sets the position of this cursor.
///
...
...
src/libstd/io/mod.rs
浏览文件 @
f65b630d
...
...
@@ -885,7 +885,7 @@ impl Initializer {
/// Returns a new `Initializer` which will zero out buffers.
#[unstable(feature
=
"read_initializer"
,
issue
=
"42788"
)]
#[inline]
pub
fn
zeroing
()
->
Initializer
{
pub
const
fn
zeroing
()
->
Initializer
{
Initializer
(
true
)
}
...
...
@@ -906,7 +906,7 @@ pub unsafe fn nop() -> Initializer {
/// Indicates if a buffer should be initialized.
#[unstable(feature
=
"read_initializer"
,
issue
=
"42788"
)]
#[inline]
pub
fn
should_initialize
(
&
self
)
->
bool
{
pub
const
fn
should_initialize
(
&
self
)
->
bool
{
self
.0
}
...
...
@@ -1653,7 +1653,7 @@ pub fn into_inner(self) -> (T, U) {
/// }
/// ```
#[stable(feature
=
"more_io_inner_methods"
,
since
=
"1.20.0"
)]
pub
fn
get_ref
(
&
self
)
->
(
&
T
,
&
U
)
{
pub
const
fn
get_ref
(
&
self
)
->
(
&
T
,
&
U
)
{
(
&
self
.first
,
&
self
.second
)
}
...
...
@@ -1780,7 +1780,7 @@ impl<T> Take<T> {
/// }
/// ```
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
limit
(
&
self
)
->
u64
{
self
.limit
}
pub
const
fn
limit
(
&
self
)
->
u64
{
self
.limit
}
/// Sets the number of bytes that can be read before this instance will
/// return EOF. This is the same as constructing a new `Take` instance, so
...
...
@@ -1856,7 +1856,7 @@ pub fn into_inner(self) -> T {
/// }
/// ```
#[stable(feature
=
"more_io_inner_methods"
,
since
=
"1.20.0"
)]
pub
fn
get_ref
(
&
self
)
->
&
T
{
pub
const
fn
get_ref
(
&
self
)
->
&
T
{
&
self
.inner
}
...
...
src/libstd/io/util.rs
浏览文件 @
f65b630d
...
...
@@ -99,7 +99,7 @@ pub struct Empty { _priv: () }
/// assert!(buffer.is_empty());
/// ```
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
empty
()
->
Empty
{
Empty
{
_
priv
:
()
}
}
pub
const
fn
empty
()
->
Empty
{
Empty
{
_
priv
:
()
}
}
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
impl
Read
for
Empty
{
...
...
@@ -199,7 +199,7 @@ pub struct Sink { _priv: () }
/// assert_eq!(num_bytes, 5);
/// ```
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
sink
()
->
Sink
{
Sink
{
_
priv
:
()
}
}
pub
const
fn
sink
()
->
Sink
{
Sink
{
_
priv
:
()
}
}
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
impl
Write
for
Sink
{
...
...
src/libstd/net/addr.rs
浏览文件 @
f65b630d
...
...
@@ -475,7 +475,7 @@ pub fn set_port(&mut self, new_port: u16) {
/// assert_eq!(socket.flowinfo(), 10);
/// ```
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
flowinfo
(
&
self
)
->
u32
{
pub
const
fn
flowinfo
(
&
self
)
->
u32
{
self
.inner.sin6_flowinfo
}
...
...
@@ -515,7 +515,7 @@ pub fn set_flowinfo(&mut self, new_flowinfo: u32) {
/// assert_eq!(socket.scope_id(), 78);
/// ```
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
scope_id
(
&
self
)
->
u32
{
pub
const
fn
scope_id
(
&
self
)
->
u32
{
self
.inner.sin6_scope_id
}
...
...
src/libstd/net/ip.rs
浏览文件 @
f65b630d
...
...
@@ -402,7 +402,7 @@ pub const fn new(a: u8, b: u8, c: u8, d: u8) -> Ipv4Addr {
/// assert_eq!(addr.octets(), [127, 0, 0, 1]);
/// ```
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
octets
(
&
self
)
->
[
u8
;
4
]
{
pub
fn
octets
(
&
self
)
->
[
u8
;
4
]
{
let
bits
=
u32
::
from_be
(
self
.inner.s_addr
);
[(
bits
>>
24
)
as
u8
,
(
bits
>>
16
)
as
u8
,
(
bits
>>
8
)
as
u8
,
bits
as
u8
]
}
...
...
@@ -424,7 +424,7 @@ pub const fn new(a: u8, b: u8, c: u8, d: u8) -> Ipv4Addr {
/// assert_eq!(Ipv4Addr::new(45, 22, 13, 197).is_unspecified(), false);
/// ```
#[stable(feature
=
"ip_shared"
,
since
=
"1.12.0"
)]
pub
fn
is_unspecified
(
&
self
)
->
bool
{
pub
const
fn
is_unspecified
(
&
self
)
->
bool
{
self
.inner.s_addr
==
0
}
...
...
@@ -862,7 +862,6 @@ impl Ipv6Addr {
/// let addr = Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff);
/// ```
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
#[rustc_const_unstable(feature
=
"const_ip"
)]
pub
const
fn
new
(
a
:
u16
,
b
:
u16
,
c
:
u16
,
d
:
u16
,
e
:
u16
,
f
:
u16
,
g
:
u16
,
h
:
u16
)
->
Ipv6Addr
{
Ipv6Addr
{
...
...
@@ -1224,7 +1223,7 @@ pub fn to_ipv4(&self) -> Option<Ipv4Addr> {
/// [255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
/// ```
#[stable(feature
=
"ipv6_to_octets"
,
since
=
"1.12.0"
)]
pub
fn
octets
(
&
self
)
->
[
u8
;
16
]
{
pub
const
fn
octets
(
&
self
)
->
[
u8
;
16
]
{
self
.inner.s6_addr
}
}
...
...
src/libstd/path.rs
浏览文件 @
f65b630d
...
...
@@ -439,7 +439,7 @@ impl<'a> PrefixComponent<'a> {
///
/// [`Prefix`]: enum.Prefix.html
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
kind
(
&
self
)
->
Prefix
<
'a
>
{
pub
const
fn
kind
(
&
self
)
->
Prefix
<
'a
>
{
self
.parsed
}
...
...
@@ -447,7 +447,7 @@ pub fn kind(&self) -> Prefix<'a> {
///
/// [`OsStr`]: ../../std/ffi/struct.OsStr.html
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
as_os_str
(
&
self
)
->
&
'a
OsStr
{
pub
const
fn
as_os_str
(
&
self
)
->
&
'a
OsStr
{
self
.raw
}
}
...
...
@@ -1918,7 +1918,7 @@ pub fn parent(&self) -> Option<&Path> {
/// [`None`]: ../../std/option/enum.Option.html#variant.None
/// [`parent`]: struct.Path.html#method.parent
#[stable(feature
=
"path_ancestors"
,
since
=
"1.28.0"
)]
pub
fn
ancestors
(
&
self
)
->
Ancestors
{
pub
const
fn
ancestors
(
&
self
)
->
Ancestors
{
Ancestors
{
next
:
Some
(
&
self
),
}
...
...
@@ -2267,7 +2267,7 @@ pub fn iter(&self) -> Iter {
/// println!("{}", path.display());
/// ```
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
display
(
&
self
)
->
Display
{
pub
const
fn
display
(
&
self
)
->
Display
{
Display
{
path
:
self
}
}
...
...
src/libstd/process.rs
浏览文件 @
f65b630d
...
...
@@ -926,7 +926,7 @@ impl Stdio {
/// assert_eq!(String::from_utf8_lossy(&output.stdout), "!dlrow ,olleH\n");
/// ```
#[stable(feature
=
"process"
,
since
=
"1.0.0"
)]
pub
fn
piped
()
->
Stdio
{
Stdio
(
imp
::
Stdio
::
MakePipe
)
}
pub
const
fn
piped
()
->
Stdio
{
Stdio
(
imp
::
Stdio
::
MakePipe
)
}
/// The child inherits from the corresponding parent descriptor.
///
...
...
@@ -961,7 +961,7 @@ pub fn piped() -> Stdio { Stdio(imp::Stdio::MakePipe) }
/// println!("You piped in the reverse of: {}", String::from_utf8_lossy(&output.stdout));
/// ```
#[stable(feature
=
"process"
,
since
=
"1.0.0"
)]
pub
fn
inherit
()
->
Stdio
{
Stdio
(
imp
::
Stdio
::
Inherit
)
}
pub
const
fn
inherit
()
->
Stdio
{
Stdio
(
imp
::
Stdio
::
Inherit
)
}
/// This stream will be ignored. This is the equivalent of attaching the
/// stream to `/dev/null`
...
...
@@ -998,7 +998,7 @@ pub fn inherit() -> Stdio { Stdio(imp::Stdio::Inherit) }
/// // Ignores any piped-in input
/// ```
#[stable(feature
=
"process"
,
since
=
"1.0.0"
)]
pub
fn
null
()
->
Stdio
{
Stdio
(
imp
::
Stdio
::
Null
)
}
pub
const
fn
null
()
->
Stdio
{
Stdio
(
imp
::
Stdio
::
Null
)
}
}
impl
FromInner
<
imp
::
Stdio
>
for
Stdio
{
...
...
src/libstd/sync/condvar.rs
浏览文件 @
f65b630d
...
...
@@ -72,7 +72,7 @@ impl WaitTimeoutResult {
/// }
/// ```
#[stable(feature
=
"wait_timeout"
,
since
=
"1.5.0"
)]
pub
fn
timed_out
(
&
self
)
->
bool
{
pub
const
fn
timed_out
(
&
self
)
->
bool
{
self
.0
}
}
...
...
src/libstd/sync/mpsc/mod.rs
浏览文件 @
f65b630d
...
...
@@ -785,7 +785,7 @@ pub fn sync_channel<T>(bound: usize) -> (SyncSender<T>, Receiver<T>) {
////////////////////////////////////////////////////////////////////////////////
impl
<
T
>
Sender
<
T
>
{
fn
new
(
inner
:
Flavor
<
T
>
)
->
Sender
<
T
>
{
const
fn
new
(
inner
:
Flavor
<
T
>
)
->
Sender
<
T
>
{
Sender
{
inner
:
UnsafeCell
::
new
(
inner
),
}
...
...
@@ -1469,7 +1469,7 @@ pub fn recv_deadline(&self, deadline: Instant) -> Result<T, RecvTimeoutError> {
/// assert_eq!(iter.next(), None);
/// ```
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
iter
(
&
self
)
->
Iter
<
T
>
{
pub
const
fn
iter
(
&
self
)
->
Iter
<
T
>
{
Iter
{
rx
:
self
}
}
...
...
@@ -1512,7 +1512,7 @@ pub fn iter(&self) -> Iter<T> {
/// assert_eq!(iter.next(), None);
/// ```
#[stable(feature
=
"receiver_try_iter"
,
since
=
"1.15.0"
)]
pub
fn
try_iter
(
&
self
)
->
TryIter
<
T
>
{
pub
const
fn
try_iter
(
&
self
)
->
TryIter
<
T
>
{
TryIter
{
rx
:
self
}
}
...
...
src/libstd/sync/mpsc/oneshot.rs
浏览文件 @
f65b630d
...
...
@@ -89,7 +89,7 @@ enum MyUpgrade<T> {
}
impl
<
T
>
Packet
<
T
>
{
pub
fn
new
()
->
Packet
<
T
>
{
pub
const
fn
new
()
->
Packet
<
T
>
{
Packet
{
data
:
UnsafeCell
::
new
(
None
),
upgrade
:
UnsafeCell
::
new
(
NothingSent
),
...
...
src/libstd/sync/once.rs
浏览文件 @
f65b630d
...
...
@@ -517,7 +517,7 @@ impl OnceState {
/// assert!(!state.poisoned());
/// });
#[unstable(feature
=
"once_poison"
,
issue
=
"33577"
)]
pub
fn
poisoned
(
&
self
)
->
bool
{
pub
const
fn
poisoned
(
&
self
)
->
bool
{
self
.poisoned
}
}
...
...
src/libstd/sys_common/mutex.rs
浏览文件 @
f65b630d
...
...
@@ -80,7 +80,7 @@ pub unsafe fn destroy(&self) { self.0.destroy() }
}
// not meant to be exported to the outside world, just the containing module
pub
fn
raw
(
mutex
:
&
Mutex
)
->
&
imp
::
Mutex
{
&
mutex
.0
}
pub
const
fn
raw
(
mutex
:
&
Mutex
)
->
&
imp
::
Mutex
{
&
mutex
.0
}
#[must_use]
/// A simple RAII utility for the above Mutex without the poisoning semantics.
...
...
src/libstd/sys_common/net.rs
浏览文件 @
f65b630d
...
...
@@ -199,7 +199,7 @@ pub fn connect_timeout(addr: &SocketAddr, timeout: Duration) -> io::Result<TcpSt
Ok
(
TcpStream
{
inner
:
sock
})
}
pub
fn
socket
(
&
self
)
->
&
Socket
{
&
self
.inner
}
pub
const
fn
socket
(
&
self
)
->
&
Socket
{
&
self
.inner
}
pub
fn
into_socket
(
self
)
->
Socket
{
self
.inner
}
...
...
@@ -339,7 +339,7 @@ pub fn bind(addr: &SocketAddr) -> io::Result<TcpListener> {
Ok
(
TcpListener
{
inner
:
sock
})
}
pub
fn
socket
(
&
self
)
->
&
Socket
{
&
self
.inner
}
pub
const
fn
socket
(
&
self
)
->
&
Socket
{
&
self
.inner
}
pub
fn
into_socket
(
self
)
->
Socket
{
self
.inner
}
...
...
@@ -427,7 +427,7 @@ pub fn bind(addr: &SocketAddr) -> io::Result<UdpSocket> {
Ok
(
UdpSocket
{
inner
:
sock
})
}
pub
fn
socket
(
&
self
)
->
&
Socket
{
&
self
.inner
}
pub
const
fn
socket
(
&
self
)
->
&
Socket
{
&
self
.inner
}
pub
fn
into_socket
(
self
)
->
Socket
{
self
.inner
}
...
...
src/libstd/sys_common/wtf8.rs
浏览文件 @
f65b630d
...
...
@@ -85,13 +85,13 @@ pub fn from_u32(value: u32) -> Option<CodePoint> {
///
/// Since all Unicode scalar values are code points, this always succeeds.
#[inline]
pub
fn
from_char
(
value
:
char
)
->
CodePoint
{
pub
const
fn
from_char
(
value
:
char
)
->
CodePoint
{
CodePoint
{
value
:
value
as
u32
}
}
/// Returns the numeric value of the code point.
#[inline]
pub
fn
to_u32
(
&
self
)
->
u32
{
pub
const
fn
to_u32
(
&
self
)
->
u32
{
self
.value
}
...
...
src/libstd/thread/mod.rs
浏览文件 @
f65b630d
...
...
@@ -286,7 +286,7 @@ impl Builder {
/// handler.join().unwrap();
/// ```
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
new
()
->
Builder
{
pub
const
fn
new
()
->
Builder
{
Builder
{
name
:
None
,
stack_size
:
None
,
...
...
@@ -1391,7 +1391,7 @@ impl<T> JoinHandle<T> {
/// println!("thread id: {:?}", thread.id());
/// ```
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
thread
(
&
self
)
->
&
Thread
{
pub
const
fn
thread
(
&
self
)
->
&
Thread
{
&
self
.0
.thread
}
...
...
src/libstd/time.rs
浏览文件 @
f65b630d
...
...
@@ -449,7 +449,7 @@ impl SystemTimeError {
/// }
/// ```
#[stable(feature
=
"time2"
,
since
=
"1.8.0"
)]
pub
fn
duration
(
&
self
)
->
Duration
{
pub
const
fn
duration
(
&
self
)
->
Duration
{
self
.0
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录