1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
//! This module implements various utilities.

pub fn join_string(list: Vec<String>, seq: &str) -> String {
    list.iter().fold(String::new(), |a, b| if a.len() > 0 { a + seq } else { a } + &b)
}

macro_rules! try_return(
    ($e:expr) => {{
        match $e {
            Ok(v) => v,
            Err(e) => { error!("Error: {}", e); return; }
        }
    }}
);