Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
e0e63a58
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,发现更多精彩内容 >>
提交
e0e63a58
编写于
10月 04, 2012
作者:
T
Tim Chevalier
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3665 from apasel422/tutorial-fix
docs: minor tutorial fixes
上级
8cb3da57
1ee05667
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
11 addition
and
11 deletion
+11
-11
doc/tutorial.md
doc/tutorial.md
+11
-11
未找到文件。
doc/tutorial.md
浏览文件 @
e0e63a58
...
...
@@ -358,7 +358,7 @@ This may sound intricate, but it is super-useful and will grow on you.
## Types
The basic types include the usual boolean, integral, and floating
point types.
The basic types include the usual boolean, integral, and floating
-
point types.
------------------------- -----------------------------------------------
`()`
Nil, the type that has only a single value
...
...
@@ -367,8 +367,8 @@ The basic types include the usual boolean, integral, and floating point types.
`i8`
,
`i16`
,
`i32`
,
`i64`
Signed integers with a specific size (in bits)
`u8`
,
`u16`
,
`u32`
,
`u64`
Unsigned integers with a specific size
`float`
The largest floating-point type efficiently supported on the target machine
`f32`
,
`f64`
Floating-point types with a specific size
.
`char`
A Unicode character (32 bits)
.
`f32`
,
`f64`
Floating-point types with a specific size
`char`
A Unicode character (32 bits)
------------------------- -----------------------------------------------
These can be combined in composite types, which will be described in
...
...
@@ -378,7 +378,7 @@ while N should be a literal number):
------------------------- -----------------------------------------------
`[T * N]`
Vector (like an array in other languages) with N elements
`[mut T * N]`
Mutable vector with N elements
`(T1, T2)`
Tuple type
. A
ny arity above 1 is supported
`(T1, T2)`
Tuple type
; a
ny arity above 1 is supported
`&T`
,
`~T`
,
`@T`
[
Pointer types
](
#boxes-and-pointers
)
------------------------- -----------------------------------------------
...
...
@@ -863,7 +863,7 @@ the return type follows the arrow.
~~~~
fn line(a: int, b: int, x: int) -> int {
return a
*
x + b;
return a
*
x + b;
}
~~~~
...
...
@@ -874,7 +874,7 @@ expression.
~~~~
fn line(a: int, b: int, x: int) -> int {
a
*
x + b
a
*
x + b
}
~~~~
...
...
@@ -891,11 +891,11 @@ fn do_nothing_the_easy_way() { }
Ending the function with a semicolon like so is equivalent to returning
`()`
.
~~~~
fn line(a: int, b: int, x: int) -> int { a
*
x + b }
fn oops(a: int, b: int, x: int) -> () { a
*
x + b; }
fn line(a: int, b: int, x: int) -> int { a
*
x + b }
fn oops(a: int, b: int, x: int) -> () { a
*
x + b; }
assert 8 == line(5,
3,
1);
assert () == oops(5,
3,
1);
assert 8 == line(5,
3,
1);
assert () == oops(5,
3,
1);
~~~~
Methods are like functions, except that they are defined for a specific
...
...
@@ -1319,7 +1319,7 @@ Strings are implemented with vectors of `[u8]`, though they have a distinct
type. They support most of the same allocation options as
vectors, though the string literal without a storage sigil, e.g.
`"foo"`
is treated differently than a comparable vector (
`[foo]`
).
Wher
as plain vectors are stack-allocated fixed
length vectors,
Wher
eas plain vectors are stack-allocated fixed-
length vectors,
plain strings are region pointers to read-only memory.
~~~
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录