pub struct PathSelection {
pub kinds: Vec<MediaKind>,
pub exts: Vec<String>,
pub paths: Vec<PathBuf>,
}Expand description
What a walking command was asked to work on.
Deliberately smaller than RowSelection and a separate type: a walk decides
whether to read a file before reading it, so it cannot answer questions
about dates, coordinates, people or true mime type. Excluding those from the
vocabulary is what makes the flags they share safe to name identically -
a scan --after meaning “re-scan known rows in this range” while
embed --after means “restrict to these files” would be one flag with two
meanings, one command apart.
Fields§
§kinds: Vec<MediaKind>§exts: Vec<String>§paths: Vec<PathBuf>Implementations§
Source§impl PathSelection
impl PathSelection
pub fn is_empty(&self) -> bool
Sourcepub fn accepts(&self, path: &Path) -> bool
pub fn accepts(&self, path: &Path) -> bool
Whether the walk should keep this path.
Pure: no database, and no I/O beyond the canonicalisation the roots already had. An empty selection accepts everything, so a command with no flags behaves exactly as before.
Sourcepub fn canonicalised(self) -> Self
pub fn canonicalised(self) -> Self
Add each root’s canonical form alongside the one given, once, so
accepts stays cheap across a walk of tens of thousands of entries.
Both forms are kept rather than the canonical one alone, because the
walk is rooted at the directory the user typed and yields paths in
that form. On macOS a tempdir, /tmp, /var, and any symlinked photo
directory all canonicalise to something with a different prefix, so
replacing the root would make a perfectly correct --path match nothing
at all - silently, since matching nothing is not an error.
pub fn describe(&self) -> String
Trait Implementations§
Source§impl Clone for PathSelection
impl Clone for PathSelection
Source§fn clone(&self) -> PathSelection
fn clone(&self) -> PathSelection
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more