diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2016-07-08 16:40:28 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2016-07-08 16:40:28 +0200 |
commit | 2e49947013f75ef0d008e783bad1126801e307b9 (patch) | |
tree | 53e126f2d55891557b04ca9ccf167071a7a486bb /libimagbookmark | |
parent | ee53a28c9a6b7a4634b996157880e35f83476b89 (diff) |
Impl BookmarkCollection::get_links_matching()
Diffstat (limited to 'libimagbookmark')
-rw-r--r-- | libimagbookmark/src/collection.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libimagbookmark/src/collection.rs b/libimagbookmark/src/collection.rs index bdee34a2..bd6b8b22 100644 --- a/libimagbookmark/src/collection.rs +++ b/libimagbookmark/src/collection.rs @@ -103,8 +103,16 @@ impl<'a> BookmarkCollection<'a> { .map_err_into(BEK::LinkError) } - pub fn get_links_matching(&self, r: Regex) -> Result<Link> { - unimplemented!() + pub fn get_links_matching(&self, r: Regex) -> Result<Option<Link>> { + self.get_external_links(self.store) + .map_err_into(BEK::LinkError) + .map(|v| { + v.into_iter() + .map(Url::into_string) + .filter(|urlstr| r.is_match(&urlstr[..])) + .map(Link::from) + .next() + }) } pub fn remove_link(&self, l: Link) -> Result<()> { |