]> git.lizzy.rs Git - rust.git/commitdiff
core: New closure syntax for comm.rs/task.rs docs
authorBenjamin Herr <ben@0x539.de>
Mon, 9 Jul 2012 11:46:32 +0000 (13:46 +0200)
committerBenjamin Herr <ben@0x539.de>
Mon, 9 Jul 2012 11:46:32 +0000 (13:46 +0200)
src/libcore/comm.rs
src/libcore/task.rs

index 7276bea5b1c04230b2b8f8b69d00f1824bc87bbf..9a50f4758f076d30a2e6fbad73fbc1674bad71d5 100644 (file)
@@ -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));
  * ~~~
index 6b871afa57d7115be1957a4e8dfccdbae46bf314..8cdcdb94bf8a08a062eb2e5634470b56a402ee88 100644 (file)
@@ -17,7 +17,7 @@
  * # Example
  *
  * ~~~
- * spawn {||
+ * do spawn {
  *     log(error, "Hello, World!");
  * }
  * ~~~
@@ -434,7 +434,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'.
      *     };
@@ -529,7 +529,7 @@ fn get_task() -> task {
  * # Example
  *
  * ~~~
- * task::unkillable {||
+ * 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