summaryrefslogtreecommitdiffstats
path: root/src/fs/dirlist.rs
diff options
context:
space:
mode:
authorJiayi Zhao <jeff.no.zhao@gmail.com>2020-08-29 22:06:19 -0400
committerJiayi Zhao <jeff.no.zhao@gmail.com>2020-08-29 22:08:23 -0400
commit5be4a5f472655a76e1430bad09a19f6ad111e474 (patch)
tree1fcffa6c8d37cc6d538b29b6fbd773e8de58512d /src/fs/dirlist.rs
parent4f3842b56f1729dcd8e81c77f98253ed9dfb23b3 (diff)
big rework and dependency update
- abstract JoshutoContext implementation behind functions - rework io workers in an attempt to fix a bug - update dependencies - remove JoshutoContextWorker
Diffstat (limited to 'src/fs/dirlist.rs')
-rw-r--r--src/fs/dirlist.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/fs/dirlist.rs b/src/fs/dirlist.rs
index df42b9a..65e2db0 100644
--- a/src/fs/dirlist.rs
+++ b/src/fs/dirlist.rs
@@ -1,3 +1,4 @@
+use std::slice::{Iter, IterMut};
use std::{fs, path};
use crate::fs::{JoshutoDirEntry, JoshutoMetadata};
@@ -31,6 +32,14 @@ impl JoshutoDirList {
})
}
+ pub fn iter(&self) -> Iter<JoshutoDirEntry> {
+ self.contents.iter()
+ }
+
+ pub fn iter_mut(&mut self) -> IterMut<JoshutoDirEntry> {
+ self.contents.iter_mut()
+ }
+
pub fn modified(&self) -> bool {
let metadata = std::fs::symlink_metadata(self.path.as_path());
match metadata {
@@ -91,8 +100,8 @@ impl JoshutoDirList {
self.contents.iter().filter(|entry| entry.is_selected())
}
- pub fn get_selected_paths(&self) -> Vec<&path::PathBuf> {
- let vec: Vec<&path::PathBuf> = self.selected_entries().map(|e| e.file_path()).collect();
+ pub fn get_selected_paths(&self) -> Vec<&path::Path> {
+ let vec: Vec<&path::Path> = self.selected_entries().map(|e| e.file_path()).collect();
if !vec.is_empty() {
vec
} else {