@@ -8,13 +8,13 @@ use cmp::Eq;
88use  result:: Result ; 
99
1010/// The either type 
11- enum  Either < T ,  U >  { 
11+ pub   enum  Either < T ,  U >  { 
1212    Left ( T ) , 
1313    Right ( U ) 
1414} 
1515
16- fn  either < T ,  U ,  V > ( f_left :  fn ( ( & T ) )  -> V , 
17-                    f_right :  fn ( ( & U ) )  -> V ,  value :  & Either < T ,  U > )  -> V  { 
16+ pub   fn  either < T ,  U ,  V > ( f_left :  fn ( ( & T ) )  -> V , 
17+                         f_right :  fn ( ( & U ) )  -> V ,  value :  & Either < T ,  U > )  -> V  { 
1818    /*! 
1919     * Applies a function based on the given either value 
2020     * 
@@ -29,7 +29,7 @@ fn either<T, U, V>(f_left: fn((&T)) -> V,
2929    } 
3030} 
3131
32- fn  lefts < T :  Copy ,  U > ( eithers :  & [ Either < T ,  U > ] )  -> ~[ T ]  { 
32+ pub   fn  lefts < T :  Copy ,  U > ( eithers :  & [ Either < T ,  U > ] )  -> ~[ T ]  { 
3333    //! Extracts from a vector of either all the left values 
3434
3535    do vec:: build_sized ( eithers. len ( ) )  |push| { 
@@ -42,7 +42,7 @@ fn lefts<T: Copy, U>(eithers: &[Either<T, U>]) -> ~[T] {
4242    } 
4343} 
4444
45- fn  rights < T ,  U :  Copy > ( eithers :  & [ Either < T ,  U > ] )  -> ~[ U ]  { 
45+ pub   fn  rights < T ,  U :  Copy > ( eithers :  & [ Either < T ,  U > ] )  -> ~[ U ]  { 
4646    //! Extracts from a vector of either all the right values 
4747
4848    do vec:: build_sized ( eithers. len ( ) )  |push| { 
@@ -56,7 +56,7 @@ fn rights<T, U: Copy>(eithers: &[Either<T, U>]) -> ~[U] {
5656} 
5757
5858// XXX bad copies. take arg by val 
59- fn  partition < T :  Copy ,  U :  Copy > ( eithers :  & [ Either < T ,  U > ] ) 
59+ pub   fn  partition < T :  Copy ,  U :  Copy > ( eithers :  & [ Either < T ,  U > ] ) 
6060    -> { lefts :  ~[ T ] ,  rights :  ~[ U ] }  { 
6161    /*! 
6262     * Extracts from a vector of either all the left values and right values 
@@ -77,7 +77,7 @@ fn partition<T: Copy, U: Copy>(eithers: &[Either<T, U>])
7777} 
7878
7979// XXX bad copies 
80- purefn  flip < T :  Copy ,  U :  Copy > ( eith :  & Either < T ,  U > )  -> Either < U ,  T >  { 
80+ pub   pure fn  flip < T :  Copy ,  U :  Copy > ( eith :  & Either < T ,  U > )  -> Either < U ,  T >  { 
8181    //! Flips between left and right of a given either 
8282
8383    match  * eith { 
@@ -87,7 +87,8 @@ pure fn flip<T: Copy, U: Copy>(eith: &Either<T, U>) -> Either<U, T> {
8787} 
8888
8989// XXX bad copies 
90- purefn  to_result < T :  Copy ,  U :  Copy > ( eith :  & Either < T ,  U > )  -> Result < U ,  T >  { 
90+ pub  pure fn  to_result < T :  Copy ,  U :  Copy > ( eith :  & Either < T ,  U > ) 
91+     -> Result < U ,  T >  { 
9192    /*! 
9293     * Converts either::t to a result::t 
9394     * 
@@ -101,27 +102,27 @@ pure fn to_result<T: Copy, U: Copy>(eith: &Either<T, U>) -> Result<U, T> {
101102    } 
102103} 
103104
104- purefn  is_left < T ,  U > ( eith :  & Either < T ,  U > )  -> bool  { 
105+ pub   pure fn  is_left < T ,  U > ( eith :  & Either < T ,  U > )  -> bool  { 
105106    //! Checks whether the given value is a left 
106107
107108    match  * eith {  Left ( _)  => true ,  _ => false  } 
108109} 
109110
110- purefn  is_right < T ,  U > ( eith :  & Either < T ,  U > )  -> bool  { 
111+ pub   pure fn  is_right < T ,  U > ( eith :  & Either < T ,  U > )  -> bool  { 
111112    //! Checks whether the given value is a right 
112113
113114    match  * eith {  Right ( _)  => true ,  _ => false  } 
114115} 
115116
116- purefn  unwrap_left < T , U > ( +eith :  Either < T , U > )  -> T  { 
117+ pub   pure fn  unwrap_left < T , U > ( +eith :  Either < T , U > )  -> T  { 
117118    //! Retrieves the value in the left branch. Fails if the either is Right. 
118119
119120    match  move  eith { 
120121        Left ( move x)  => move  x,  Right ( _)  => fail ~"either:: unwrap_left Right "
121122    } 
122123} 
123124
124- purefn  unwrap_right < T , U > ( +eith :  Either < T , U > )  -> U  { 
125+ pub   pure fn  unwrap_right < T , U > ( +eith :  Either < T , U > )  -> U  { 
125126    //! Retrieves the value in the right branch. Fails if the either is Left. 
126127
127128    match  move  eith { 
0 commit comments