fn sequence<T>(seq: Vec<Result<T, Error>>) -> Result<Vec<T>, Error>
    where T: Clone {
    let result = seq.into_iter().fold(Ok(vec![]), |result, current|
        result.and_then(|mut vec|
            match current {
                Ok(value) => {
                    vec.push(value.clone());
                    Ok(vec)
                }
                Err(e) => Err(e)
            }));
    result
}
/// Traverse a Vec<Result<T, Error>> and combine the values to return a Result<Vec<T>, Error>
///
/// If all values of the vector are Ok then return a Ok containing all the values cloned
/// On the first Err it stop accumulating values and return the matched error
///
/// T must be a Clone type
Traverse a Vec> and combine the values to return a Result, Error>
If all values of the vector are Ok then return a Ok containing all the values cloned
On the first Err it stop accumulating values and return the matched error

T must be a Clone type
Traverse a Vec > and combine the values to return a Result Error > If all values of the vector are Ok then return a Ok containing all the values cloned On the first Err it stop accumulating values and return the matched error T must be a Clone type
fn sequence<T>(seq: Vec<Result<T, Error>>) -> Result<Vec<T>, Error>
    where T: Clone {
    let result = seq.into_iter().fold(Ok(vec![]), |result, current|
        result.and_then(|mut vec|
            match current {
                Ok(value) => {
                    vec.push(value.clone());
                    Ok(vec)
                }
                Err(e) => Err(e)
            }));
    result
}
fn sequence < T > ( seq : Vec < Result < T , Error > > ) -> Result < Vec < T > , Error > where T : Clone { let result = seq . into_iter ( ) . fold ( Ok ( vec ! [ ] ) , | result , current | result . and_then ( | mut vec | match current { Ok ( value ) => { vec . push ( value . clone ( ) ) ; Ok ( vec ) } Err ( e ) => Err ( e ) } ) ) ; result }
Traverse a Vec<Result<T, Error>> and combine the values to return a Result<Vec<T>, Error>
If all values of the vector are Ok then return a Ok containing all the values cloned
On the first Err it stop accumulating values and return the matched error
Traverse a Vec<Result<T Error >> and combine the values to return a Result<Vec<T > Error > If all values of the vector are Ok then return a Ok containing all the values cloned On the first Err it stop accumulating values and return the matched error
seq
Vec<Result<T, Error>>