about summary refs log tree commit diff
path: root/src/libextra
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2013-05-27 09:49:54 -0400
committerDaniel Micay <danielmicay@gmail.com>2013-05-27 14:47:21 -0400
commit0d5fdce82e1e09df96ea2ee190e9fffd91b2c714 (patch)
tree3a003da2cb972550f937356f803fa6461ff8f56c /src/libextra
parent3941f78a1bfb3ecf077dd782e5d03ea7fafcad86 (diff)
downloadrust-0d5fdce82e1e09df96ea2ee190e9fffd91b2c714.tar.gz
rust-0d5fdce82e1e09df96ea2ee190e9fffd91b2c714.zip
syntax highlight code examples in docstrings
Diffstat (limited to 'src/libextra')
-rw-r--r--src/libextra/arc.rs7
-rw-r--r--src/libextra/base64.rs24
-rw-r--r--src/libextra/flatpipes.rs2
-rw-r--r--src/libextra/future.rs2
-rw-r--r--src/libextra/net_tcp.rs4
-rw-r--r--src/libextra/sync.rs5
6 files changed, 25 insertions, 19 deletions
diff --git a/src/libextra/arc.rs b/src/libextra/arc.rs
index 123e7275935..319fb83d3f8 100644
--- a/src/libextra/arc.rs
+++ b/src/libextra/arc.rs
@@ -17,7 +17,7 @@
  * In this example, a large vector of floats is shared between several tasks.
  * With simple pipes, without ARC, a copy would have to be made for each task.
  *
- * ~~~
+ * ~~~ {.rust}
  * extern mod std;
  * use std::arc;
  * let numbers=vec::from_fn(100, |ind| (ind as float)*rand::random());
@@ -370,7 +370,10 @@ pub impl<T:Const + Owned> RWARC<T> {
      * See sync::rwlock.write_downgrade(). The RWWriteMode token must be used
      * to obtain the &mut T, and can be transformed into a RWReadMode token by
      * calling downgrade(), after which a &T can be obtained instead.
-     * ~~~
+     *
+     * # Example
+     *
+     * ~~~ {.rust}
      * do arc.write_downgrade |write_mode| {
      *     do (&write_mode).write_cond |state, condvar| {
      *         ... exclusive access with mutable state ...
diff --git a/src/libextra/base64.rs b/src/libextra/base64.rs
index 41584710a41..e06bf284482 100644
--- a/src/libextra/base64.rs
+++ b/src/libextra/base64.rs
@@ -28,9 +28,9 @@ impl<'self> ToBase64 for &'self [u8] {
     /**
      * Turn a vector of `u8` bytes into a base64 string.
      *
-     * *Example*:
+     * # Example
      *
-     * ~~~~
+     * ~~~ {.rust}
      * extern mod std;
      * use std::base64::ToBase64;
      *
@@ -38,7 +38,7 @@ impl<'self> ToBase64 for &'self [u8] {
      *     let str = [52,32].to_base64();
      *     println(fmt!("%s", str));
      * }
-     * ~~~~
+     * ~~~
      */
     fn to_base64(&self) -> ~str {
         let mut s = ~"";
@@ -91,9 +91,9 @@ impl<'self> ToBase64 for &'self str {
      * Convert any string (literal, `@`, `&`, or `~`) to base64 encoding.
      *
      *
-     * *Example*:
+     * # Example
      *
-     * ~~~~
+     * ~~~ {.rust}
      * extern mod std;
      * use std::base64::ToBase64;
      *
@@ -101,7 +101,7 @@ impl<'self> ToBase64 for &'self str {
      *     let str = "Hello, World".to_base64();
      *     println(fmt!("%s",str));
      * }
-     * ~~~~
+     * ~~~
      *
      */
     fn to_base64(&self) -> ~str {
@@ -118,9 +118,9 @@ impl FromBase64 for ~[u8] {
      * Convert base64 `u8` vector into u8 byte values.
      * Every 4 encoded characters is converted into 3 octets, modulo padding.
      *
-     * *Example*:
+     * # Example
      *
-     * ~~~~
+     * ~~~ {.rust}
      * extern mod std;
      * use std::base64::ToBase64;
      * use std::base64::FromBase64;
@@ -131,7 +131,7 @@ impl FromBase64 for ~[u8] {
      *     let bytes = str.from_base64();
      *     println(fmt!("%?",bytes));
      * }
-     * ~~~~
+     * ~~~
      */
     fn from_base64(&self) -> ~[u8] {
         if self.len() % 4u != 0u { fail!("invalid base64 length"); }
@@ -196,11 +196,11 @@ impl FromBase64 for ~str {
      * You can use the `from_bytes` function in `core::str`
      * to turn a `[u8]` into a string with characters corresponding to those values.
      *
-     * *Example*:
+     * # Example
      *
      * This converts a string literal to base64 and back.
      *
-     * ~~~~
+     * ~~~ {.rust}
      * extern mod std;
      * use std::base64::ToBase64;
      * use std::base64::FromBase64;
@@ -214,7 +214,7 @@ impl FromBase64 for ~str {
      *     let result_str = str::from_bytes(bytes);
      *     println(fmt!("%s",result_str));
      * }
-     * ~~~~
+     * ~~~
      */
     fn from_base64(&self) -> ~[u8] {
         str::to_bytes(*self).from_base64()
diff --git a/src/libextra/flatpipes.rs b/src/libextra/flatpipes.rs
index 76361db7d76..ed9614285e9 100644
--- a/src/libextra/flatpipes.rs
+++ b/src/libextra/flatpipes.rs
@@ -25,7 +25,7 @@ ports and channels.
 
 This example sends boxed integers across tasks using serialization.
 
-~~~
+~~~ {.rust}
 let (port, chan) = serial::pipe_stream();
 
 do task::spawn || {
diff --git a/src/libextra/future.rs b/src/libextra/future.rs
index f54286b3fdf..38df0c6a208 100644
--- a/src/libextra/future.rs
+++ b/src/libextra/future.rs
@@ -14,7 +14,7 @@
  *
  * # Example
  *
- * ~~~
+ * ~~~ {.rust}
  * # fn fib(n: uint) -> uint {42};
  * # fn make_a_sandwich() {};
  * let mut delayed_fib = std::future::spawn (|| fib(5000) );
diff --git a/src/libextra/net_tcp.rs b/src/libextra/net_tcp.rs
index ae1707c9922..aaa10fe562a 100644
--- a/src/libextra/net_tcp.rs
+++ b/src/libextra/net_tcp.rs
@@ -466,7 +466,7 @@ fn read_future(sock: &TcpSocket, timeout_msecs: uint)
  * Here, the `new_conn` is used in conjunction with `accept` from within
  * a task spawned by the `new_connect_cb` passed into `listen`
  *
- * ~~~~~~~~~~~
+ * ~~~ {.rust}
  * do net::tcp::listen(remote_ip, remote_port, backlog, iotask,
  *     // this callback is ran once after the connection is successfully
  *     // set up
@@ -497,7 +497,7 @@ fn read_future(sock: &TcpSocket, timeout_msecs: uint)
  *       None => ()
  *     }
  * };
- * ~~~~~~~~~~~
+ * ~~~
  *
  * # Arguments
  *
diff --git a/src/libextra/sync.rs b/src/libextra/sync.rs
index 9e0ebc02221..5768b015ab1 100644
--- a/src/libextra/sync.rs
+++ b/src/libextra/sync.rs
@@ -545,7 +545,10 @@ pub impl RWlock {
      * the meantime (such as unlocking and then re-locking as a reader would
      * do). The block takes a "write mode token" argument, which can be
      * transformed into a "read mode token" by calling downgrade(). Example:
-     * ~~~
+     *
+     * # Example
+     *
+     * ~~~ {.rust}
      * do lock.write_downgrade |write_mode| {
      *     do (&write_mode).write_cond |condvar| {
      *         ... exclusive access ...