//! Functions for iterating over the cache.
usestd::path::Path;usecrate::errors::Result;usecrate::index;/// Returns a synchronous iterator that lists all cache index entries.
pubfnlist_sync<P:AsRef<Path>>(cache: P)-> impl Iterator<Item = Result<index::Metadata>>{index::ls(cache.as_ref())}#[cfg(test)]modtests{usesuper::*;#[test]fntest_list_sync(){// check that the public interface to list elements can actually use the
// Iterator::Item
let tmp =tempfile::tempdir().unwrap();let dir = tmp.path().to_owned();assert!(list_sync(dir).map(|x|Ok(x?.key)).collect::<Result<Vec<_>>>().is_err())}}