rstd 0.3.0

A library providing an easy/ergonomic interface to some functions to help ease my students into Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
use std::str::pattern::Pattern;

pub trait NonEmptySplit {
	fn split_nonempty<'a, P: Pattern<'a>>(&'a self, pat: P) -> Vec<String>;
}

impl NonEmptySplit for str {
	fn split_nonempty<'a, P: Pattern<'a>>(&'a self, pat: P) -> Vec<String> {
		self.split(pat).filter(|x| !x.is_empty()).map(String::from).collect()
	}
}