Fix usages of get_external_links()
This commit is contained in:
parent
db17b4f858
commit
c229bb1575
2 changed files with 7 additions and 4 deletions
|
@ -296,7 +296,7 @@ fn set_links_for_entry(store: &Store, matches: &ArgMatches, entry: &mut FileLock
|
|||
fn list_links_for_entry(store: &Store, entry: &mut FileLockEntry) {
|
||||
entry.get_external_links(store)
|
||||
.and_then(|links| {
|
||||
for (i, link) in links.iter().enumerate() {
|
||||
for (i, link) in links.enumerate() {
|
||||
println!("{: <3}: {}", i, link);
|
||||
}
|
||||
Ok(())
|
||||
|
|
|
@ -37,6 +37,7 @@ use libimagstore::store::Store;
|
|||
use libimagstore::storeid::IntoStoreId;
|
||||
use libimagstore::store::FileLockEntry;
|
||||
use libimagentrylink::external::ExternalLinker;
|
||||
use libimagentrylink::external::iter::UrlIter;
|
||||
use libimagentrylink::internal::InternalLinker;
|
||||
use libimagentrylink::internal::Link as StoreLink;
|
||||
use libimagerror::into::IntoError;
|
||||
|
@ -105,7 +106,7 @@ impl<'a> BookmarkCollection<'a> {
|
|||
.map_err_into(BEK::StoreReadError)
|
||||
}
|
||||
|
||||
pub fn links(&self) -> Result<Vec<Url>> {
|
||||
pub fn links(&self) -> Result<UrlIter> {
|
||||
self.fle.get_external_links(&self.store).map_err_into(BEK::LinkError)
|
||||
}
|
||||
|
||||
|
@ -126,11 +127,13 @@ impl<'a> BookmarkCollection<'a> {
|
|||
.map_err_into(BEK::LinkError)
|
||||
}
|
||||
|
||||
pub fn get_links_matching(&self, r: Regex) -> Result<Vec<Link>> {
|
||||
pub fn get_links_matching(&self, r: Regex) -> Result<UrlIter> {
|
||||
use std::result::Result as RResult;
|
||||
|
||||
self.get_external_links(self.store)
|
||||
.map_err_into(BEK::LinkError)
|
||||
.map(|v| {
|
||||
v.into_iter()
|
||||
v.filter_map(RResult::ok) // TODO: Do not ignore errors here
|
||||
.map(Url::into_string)
|
||||
.filter(|urlstr| r.is_match(&urlstr[..]))
|
||||
.map(Link::from)
|
||||
|
|
Loading…
Reference in a new issue