Add StorageBackend::iter_ids()
This commit is contained in:
parent
d22b991da0
commit
1b6711fe10
1 changed files with 12 additions and 0 deletions
|
@ -8,6 +8,7 @@ use std::vec::Vec;
|
|||
use std::fs::File as FSFile;
|
||||
use std::io::Read;
|
||||
use std::io::Write;
|
||||
use std::vec::IntoIter;
|
||||
|
||||
use glob::glob;
|
||||
use glob::Paths;
|
||||
|
@ -61,6 +62,17 @@ impl StorageBackend {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn iter_ids(&self, m: &Module) -> Option<IntoIter<FileID>>
|
||||
{
|
||||
glob(&self.prefix_of_files_for_module(m)[..]).and_then(|globlist| {
|
||||
let v = globlist.filter_map(Result::ok)
|
||||
.map(|pbuf| from_pathbuf(&pbuf))
|
||||
.collect::<Vec<FileID>>()
|
||||
.into_iter();
|
||||
Ok(v)
|
||||
}).ok()
|
||||
}
|
||||
|
||||
/*
|
||||
* Write a file to disk.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue