fn filter_sessions(labels: &str) -> Vec<Session> {
    let history = read_history().unwrap();
    let mut filtered: Vec<Session> = vec![];

    for label in labels.split(',') {
        for session in history.iter() {
            // Check if session contains label
            // TODO: Avoid cloning by using `Move Semantics`:
            // session.labels.into_iter()
            if session.labels.iter().any(|p| p == label.trim()) {
                filtered.push(session.clone());
            }
        }
    }

    if labels == "" {
        history
    } else {
        filtered
    }
}
// Filter session's by label
Filter session's by label
Filter session ' s by label
fn filter_sessions(labels: &str) -> Vec<Session> {
    let history = read_history().unwrap();
    let mut filtered: Vec<Session> = vec![];
    for label in labels.split(',') {
        for session in history.iter() {
            // Check if session contains label
            // TODO: Avoid cloning by using `Move Semantics`:
            // session.labels.into_iter()
            if session.labels.iter().any(|p| p == label.trim()) {
                filtered.push(session.clone());
            }
        }
    }
    if labels == "" {
        history
    } else {
        filtered
    }
}
fn filter_sessions ( labels : & str ) -> Vec < Session > { let history = read_history ( ) . unwrap ( ) ; let mut filtered : Vec < Session > = vec ! [ ] ; for label in labels . split ( ',' ) { for session in history . iter ( ) { // Check if session contains label // TODO: Avoid cloning by using `Move Semantics`: // session.labels.into_iter() if session . labels . iter ( ) . any ( | p | p == label . trim ( ) ) { filtered . push ( session . clone ( ) ) ; } } } if labels == " " { history } else { filtered } }
Filter session's by label
Filter session ' s by label
labels
&str