pub struct PathScanner { /* private fields */ }Expand description
Walks directories (usually from $PATH) looking for executable
files by name. Caches the directory list so repeated lookups
during a single discovery pass don’t re-read the env var.
Implementations§
Source§impl PathScanner
impl PathScanner
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Build a scanner from the current process $PATH. Empty on
platforms where PATH is unset.
pub fn from_dirs(dirs: Vec<PathBuf>) -> Self
pub fn dirs(&self) -> &[PathBuf]
Sourcepub fn find_first(&self, name: &str) -> Option<PathBuf>
pub fn find_first(&self, name: &str) -> Option<PathBuf>
First executable entry matching name, walking directories in
$PATH order. Skips unreadable directories silently.
Trait Implementations§
Source§impl Clone for PathScanner
impl Clone for PathScanner
Source§fn clone(&self) -> PathScanner
fn clone(&self) -> PathScanner
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PathScanner
impl RefUnwindSafe for PathScanner
impl Send for PathScanner
impl Sync for PathScanner
impl Unpin for PathScanner
impl UnsafeUnpin for PathScanner
impl UnwindSafe for PathScanner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more