Add readme for web provider

Also rename sample web provider implemented in Rust to `web-rust`.
This commit is contained in:
Rajasekharan Vengalil
2018-02-11 10:03:15 +05:30
parent d23ac6679c
commit 2abccb0257
16 changed files with 186 additions and 29 deletions

View File

@@ -0,0 +1,18 @@
pub trait Filter<T> {
fn xfilter<P: FnOnce(&T) -> bool>(self, predicate: P) -> Self;
}
impl<T> Filter<T> for Option<T> {
fn xfilter<P: FnOnce(&T) -> bool>(self, predicate: P) -> Self {
match self {
Some(x) => {
if predicate(&x) {
Some(x)
} else {
None
}
}
None => None,
}
}
}