Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
3b399afa
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,发现更多精彩内容 >>
提交
3b399afa
编写于
7月 09, 2012
作者:
B
Brian Anderson
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2847 from ben0x539/incoming
Tiny documentation fixes in rust.md and src/libcore/task.rs
上级
547bf7c3
4ac71595
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
30 deletion
+29
-30
doc/rust.md
doc/rust.md
+11
-11
src/libcore/comm.rs
src/libcore/comm.rs
+2
-2
src/libcore/task.rs
src/libcore/task.rs
+16
-17
未找到文件。
doc/rust.md
浏览文件 @
3b399afa
...
...
@@ -2871,12 +2871,12 @@ Consists of 2 statements, 3 expressions and 12 points:
*
the point after evaluating the static initializer
`"hello, world"`
*
the point after the first statement
*
the point before the second statement
*
the point before evaluating the function value
`print`
*
the point after evaluating the function value
`print`
*
the point before evaluating the arguments to
`print`
*
the point before evaluating the function value
`print
ln
`
*
the point after evaluating the function value
`print
ln
`
*
the point before evaluating the arguments to
`print
ln
`
*
the point before evaluating the symbol
`s`
*
the point after evaluating the symbol
`s`
*
the point after evaluating the arguments to
`print`
*
the point after evaluating the arguments to
`print
ln
`
*
the point after the second statement
...
...
@@ -2894,9 +2894,9 @@ Consists of 1 statement, 7 expressions and 14 points:
*
the point before the statement
*
the point before evaluating the function value
`print`
*
the point after evaluating the function value
`print`
*
the point before evaluating the arguments to
`print`
*
the point before evaluating the function value
`print
ln
`
*
the point after evaluating the function value
`print
ln
`
*
the point before evaluating the arguments to
`print
ln
`
*
the point before evaluating the arguments to
`+`
*
the point before evaluating the function value
`x`
*
the point after evaluating the function value
`x`
...
...
@@ -2907,7 +2907,7 @@ Consists of 1 statement, 7 expressions and 14 points:
*
the point before evaluating the arguments to
`y`
*
the point after evaluating the arguments to
`y`
*
the point after evaluating the arguments to
`+`
*
the point after evaluating the arguments to
`print`
*
the point after evaluating the arguments to
`print
ln
`
The typestate system reasons over points, rather than statements or
...
...
@@ -3186,7 +3186,7 @@ let x: ~int = ~10;
~~~~~~~~
Some operations (such as field selection) implicitly dereference boxes. An
example of an
@dfn{implicit dereference}
operation performed on box values:
example of an
_implicit dereference_
operation performed on box values:
~~~~~~~~
let x = @{y: 10};
...
...
@@ -3196,8 +3196,8 @@ assert x.y == 10;
Other operations act on box values as single-word-sized address values. For
these operations, to access the value held in the box requires an explicit
dereference of the box value. Explicitly dereferencing a box is indicated with
the unary
*star*
operator
`*`
. Examples of such
@dfn{explicit
dereference}
operations are:
the unary
*star*
operator
`*`
. Examples of such
_explicit dereference_
operations are:
*
copying box values (
`x = y`
)
*
passing box values to functions (
`f(x,y)`
)
...
...
src/libcore/comm.rs
浏览文件 @
3b399afa
...
...
@@ -16,9 +16,9 @@
* let po = comm::port();
* let ch = comm::chan(po);
*
*
task::spawn {||
*
do task::spawn {
* comm::send(ch, "Hello, World");
* }
);
* }
*
* io::println(comm::recv(p));
* ~~~
...
...
src/libcore/task.rs
浏览文件 @
3b399afa
...
...
@@ -17,7 +17,7 @@
* # Example
*
* ~~~
*
spawn {||
*
do spawn {
* log(error, "Hello, World!");
* }
* ~~~
...
...
@@ -350,7 +350,6 @@ fn run_with<A:send>(-builder: builder,
+
f
:
fn
~
(
+
A
))
{
/*!
*
* Runs a task, while transfering ownership of one argument to the
* child.
*
...
...
@@ -412,15 +411,13 @@ fn spawn(+f: fn~()) {
fn
spawn_with
<
A
:
send
>
(
+
arg
:
A
,
+
f
:
fn
~
(
+
A
))
{
/*!
* Runs a new task while providing a channel from the parent to the child
* Runs a task, while transfering ownership of one argument to the
* child.
*
* Sets up a communication channel from the current task to the new
* child task, passes the port to child's body, and returns a channel
* linked to the port to the parent.
* This is useful for transfering ownership of noncopyables to
* another task.
*
* This encapsulates some boilerplate handshaking logic that would
* otherwise be required to establish communication from the parent
* to the child.
* This function is equivalent to `run_with(builder(), arg, f)`.
*/
run_with
(
builder
(),
arg
,
f
)
...
...
@@ -443,7 +440,7 @@ fn spawn_listener<A:send>(+f: fn~(comm::port<A>)) -> comm::chan<A> {
*
* let po = comm::port();
* let ch = comm::chan(po);
* let ch =
spawn_listener {|po|
* let ch =
do spawn_listener |po| {
* // Now the child has a port called 'po' to read from and
* // an environment-captured channel called 'ch'.
* };
...
...
@@ -537,13 +534,15 @@ fn get_task() -> task {
*
* # Example
*
* task::unkillable {||
* // detach / yield / destroy must all be called together
* rustrt::rust_port_detach(po);
* // This must not result in the current task being killed
* task::yield();
* rustrt::rust_port_destroy(po);
* }
* ~~~
* do task::unkillable {
* // detach / yield / destroy must all be called together
* rustrt::rust_port_detach(po);
* // This must not result in the current task being killed
* task::yield();
* rustrt::rust_port_destroy(po);
* }
* ~~~
*/
unsafe
fn
unkillable
(
f
:
fn
())
{
class
allow_failure
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录