Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
0615fddd
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,发现更多精彩内容 >>
提交
0615fddd
编写于
4月 14, 2013
作者:
B
Brendan Zabarauskas
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove unnecessary enclosing modules for NumCast impls
上级
c4685477
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
22 addition
and
30 deletion
+22
-30
src/libcore/num/num.rs
src/libcore/num/num.rs
+22
-30
未找到文件。
src/libcore/num/num.rs
浏览文件 @
0615fddd
...
...
@@ -110,37 +110,29 @@ pub trait NumCast {
macro_rules!
impl_num_cast
(
(
$T:ty
,
$conv:ident
)
=>
(
// FIXME #4375: This enclosing module is necessary because
// of a bug with macros expanding into multiple items
pub
mod
$conv
{
use
num
::
NumCast
;
#[cfg(notest)]
impl
NumCast
for
$T
{
#[doc
=
"Cast `n` to a `$T`"
]
#[inline(always)]
fn
from
<
N
:
NumCast
>
(
n
:
N
)
->
$T
{
// `$conv` could be generated using `concat_idents!`, but that
// macro seems to be broken at the moment
n
.
$conv
()
}
#[inline(always)]
fn
to_u8
(
&
self
)
->
u8
{
*
self
as
u8
}
#[inline(always)]
fn
to_u16
(
&
self
)
->
u16
{
*
self
as
u16
}
#[inline(always)]
fn
to_u32
(
&
self
)
->
u32
{
*
self
as
u32
}
#[inline(always)]
fn
to_u64
(
&
self
)
->
u64
{
*
self
as
u64
}
#[inline(always)]
fn
to_uint
(
&
self
)
->
uint
{
*
self
as
uint
}
#[inline(always)]
fn
to_i8
(
&
self
)
->
i8
{
*
self
as
i8
}
#[inline(always)]
fn
to_i16
(
&
self
)
->
i16
{
*
self
as
i16
}
#[inline(always)]
fn
to_i32
(
&
self
)
->
i32
{
*
self
as
i32
}
#[inline(always)]
fn
to_i64
(
&
self
)
->
i64
{
*
self
as
i64
}
#[inline(always)]
fn
to_int
(
&
self
)
->
int
{
*
self
as
int
}
#[inline(always)]
fn
to_f32
(
&
self
)
->
f32
{
*
self
as
f32
}
#[inline(always)]
fn
to_f64
(
&
self
)
->
f64
{
*
self
as
f64
}
#[inline(always)]
fn
to_float
(
&
self
)
->
float
{
*
self
as
float
}
impl
NumCast
for
$T
{
#[inline(always)]
fn
from
<
N
:
NumCast
>
(
n
:
N
)
->
$T
{
// `$conv` could be generated using `concat_idents!`, but that
// macro seems to be broken at the moment
n
.
$conv
()
}
#[inline(always)]
fn
to_u8
(
&
self
)
->
u8
{
*
self
as
u8
}
#[inline(always)]
fn
to_u16
(
&
self
)
->
u16
{
*
self
as
u16
}
#[inline(always)]
fn
to_u32
(
&
self
)
->
u32
{
*
self
as
u32
}
#[inline(always)]
fn
to_u64
(
&
self
)
->
u64
{
*
self
as
u64
}
#[inline(always)]
fn
to_uint
(
&
self
)
->
uint
{
*
self
as
uint
}
#[inline(always)]
fn
to_i8
(
&
self
)
->
i8
{
*
self
as
i8
}
#[inline(always)]
fn
to_i16
(
&
self
)
->
i16
{
*
self
as
i16
}
#[inline(always)]
fn
to_i32
(
&
self
)
->
i32
{
*
self
as
i32
}
#[inline(always)]
fn
to_i64
(
&
self
)
->
i64
{
*
self
as
i64
}
#[inline(always)]
fn
to_int
(
&
self
)
->
int
{
*
self
as
int
}
#[inline(always)]
fn
to_f32
(
&
self
)
->
f32
{
*
self
as
f32
}
#[inline(always)]
fn
to_f64
(
&
self
)
->
f64
{
*
self
as
f64
}
#[inline(always)]
fn
to_float
(
&
self
)
->
float
{
*
self
as
float
}
}
)
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录