pub fn collect_as_vector<T: Clone>(list: &[T], (bound1, bound2): (usize, usize)) -> Vec<T> {
let mut collector: Vec<T> = vec![];
for index in bound1 .. bound2 + 1 {
collector.push(list[index].clone());
}
collector
}
pub fn filter_break<T: Clone, F>(list: &[T], pred: F) -> Vec<T>
where F: Fn(&T) -> bool {
let mut collector: Vec<T> = vec![];
for item in list {
if ! pred(item) {
return collector.clone();
}
collector.push(item.clone());
}
return collector.clone();
}
pub fn drop_break<T: Clone, F>(list: &[T], pred: F) -> Vec<T> where F: Fn(&T) -> bool {
for item in 0 .. list.len() {
if ! pred(&list[item]) {
return collect_as_vector(list, (item + 1, list.len() - 1));
}
}
vec![]
}