From 0d5fdce82e1e09df96ea2ee190e9fffd91b2c714 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Mon, 27 May 2013 09:49:54 -0400 Subject: syntax highlight code examples in docstrings --- src/libstd/vec.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/libstd/vec.rs') 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(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(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(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(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(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)); * } -- cgit 1.4.1-3-g733a5