[−][src]Struct which::Path
An owned, immutable wrapper around a PathBuf
containing the path of an executable.
The constructed PathBuf
is the output of which
or which_in
, but which::Path
has the
advantage of being a type distinct from std::path::Path
and std::path::PathBuf
.
It can be beneficial to use which::Path
instead of std::path::Path
when you want the type
system to enforce the need for a path that exists and points to a binary that is executable.
Since which::Path
implements Deref
for std::path::Path
, all methods on &std::path::Path
are also available to &which::Path
values.
Methods
impl Path
[src]
pub fn new<T: AsRef<OsStr>>(binary_name: T) -> Result<Path>
[src]
Returns the path of an executable binary by name.
This calls which
and maps the result into a Path
.
pub fn new_in<T, U, V>(binary_name: T, paths: Option<U>, cwd: V) -> Result<Path> where
T: AsRef<OsStr>,
U: AsRef<OsStr>,
V: AsRef<Path>,
[src]
T: AsRef<OsStr>,
U: AsRef<OsStr>,
V: AsRef<Path>,
Returns the path of an executable binary by name in the path list paths
and using the
current working directory cwd
to resolve relative paths.
This calls which_in
and maps the result into a Path
.
pub fn as_path(&self) -> &Path
[src]
Returns a reference to a std::path::Path
.
pub fn into_path_buf(self) -> PathBuf
[src]
Consumes the which::Path
, yielding its underlying std::path::PathBuf
.
Trait Implementations
impl AsRef<OsStr> for Path
[src]
impl AsRef<Path> for Path
[src]
impl Clone for Path
[src]
impl Debug for Path
[src]
impl Deref for Path
[src]
impl Eq for Path
[src]
impl PartialEq<Path> for Path
[src]
impl PartialEq<Path> for PathBuf
[src]
impl PartialEq<PathBuf> for Path
[src]
impl StructuralPartialEq for Path
[src]
Auto Trait Implementations
impl RefUnwindSafe for Path
impl Send for Path
impl Sync for Path
impl Unpin for Path
impl UnwindSafe for Path
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,