Impl BookmarkCollection::get_links_matching()

This commit is contained in:
Matthias Beyer 2016-07-08 16:40:28 +02:00
parent ee53a28c9a
commit 2e49947013

View file

@ -103,8 +103,16 @@ impl<'a> BookmarkCollection<'a> {
.map_err_into(BEK::LinkError) .map_err_into(BEK::LinkError)
} }
pub fn get_links_matching(&self, r: Regex) -> Result<Link> { pub fn get_links_matching(&self, r: Regex) -> Result<Option<Link>> {
unimplemented!() 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<()> { pub fn remove_link(&self, l: Link) -> Result<()> {