diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2013-05-27 09:49:54 -0400 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2013-05-27 14:47:21 -0400 |
| commit | 0d5fdce82e1e09df96ea2ee190e9fffd91b2c714 (patch) | |
| tree | 3a003da2cb972550f937356f803fa6461ff8f56c /src/libstd/vec.rs | |
| parent | 3941f78a1bfb3ecf077dd782e5d03ea7fafcad86 (diff) | |
| download | rust-0d5fdce82e1e09df96ea2ee190e9fffd91b2c714.tar.gz rust-0d5fdce82e1e09df96ea2ee190e9fffd91b2c714.zip | |
syntax highlight code examples in docstrings
Diffstat (limited to 'src/libstd/vec.rs')
| -rw-r--r-- | src/libstd/vec.rs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index 103489988a3..7e73158fee4 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -977,7 +977,7 @@ pub fn connect<T:Copy>(v: &[~[T]], sep: &T) -> ~[T] { * * Sum all values in the vector [1, 2, 3]: * - * ~~~ + * ~~~ {.rust} * vec::foldl(0, [1, 2, 3], |a, b| a + *b); * ~~~ * @@ -1009,7 +1009,7 @@ pub fn foldl<'a, T, U>(z: T, v: &'a [U], p: &fn(t: T, u: &'a U) -> T) -> T { * * Sum all values in the vector [1, 2, 3]: * - * ~~~ + * ~~~ {.rust} * vec::foldr([1, 2, 3], 0, |a, b| a + *b); * ~~~ * @@ -1376,10 +1376,8 @@ pub fn reverse<T>(v: &mut [T]) { * * Assume a mutable vector `v` contains `[1,2,3,4,5]`. After the call: * - * ~~~ - * + * ~~~ {.rust} * reverse_part(v, 1, 4); - * * ~~~ * * `v` now contains `[1,4,3,2,5]`. @@ -1416,14 +1414,15 @@ pub fn reversed<T:Copy>(v: &const [T]) -> ~[T] { * * continue iterating, false to break. * * # Examples - * ~~~ + * + * ~~~ {.rust} * [1,2,3].each(|&i| { * io::println(int::str(i)); * true * }); * ~~~ * - * ~~~ + * ~~~ {.rust} * [1,2,3,4,5].each(|&i| { * if i < 4 { * io::println(int::str(i)); @@ -1438,7 +1437,7 @@ pub fn reversed<T:Copy>(v: &const [T]) -> ~[T] { * You probably will want to use each with a `for`/`do` expression, depending * on your iteration needs: * - * ~~~ + * ~~~ {.rust} * for [1,2,3].each |&i| { * io::println(int::str(i)); * } @@ -1700,7 +1699,7 @@ pub fn each_permutation<T:Copy>(values: &[T], fun: &fn(perm : &[T]) -> bool) -> * * Print the adjacent pairs of a vector (i.e. `[1,2]`, `[2,3]`, `[3,4]`) * - * ~~~ + * ~~~ {.rust} * for windowed(2, &[1,2,3,4]) |v| { * io::println(fmt!("%?", v)); * } |
