pub enum Target {
Builtin {
builtin: Builtin,
path: Option<CString>,
},
Function(Rc<Function>),
External {
path: CString,
},
}
Expand description
Target of a simple command execution
This is the result of the command search.
§Notes on equality
Although this type implements PartialEq
, comparison between instances of
this type may not always yield predictable results due to the presence of
function pointers in Builtin
. As a result, it is recommended to avoid
relying on equality comparisons for values of this type. See
https://doc.rust-lang.org/std/ptr/fn.fn_addr_eq.html for the
characteristics of function pointer comparisons.
Variants§
Builtin
Built-in utility
Fields
path: Option<CString>
Path to the external utility that is shadowed by the substitutive built-in
The path may not necessarily be absolute. If the $PATH
variable
contains a relative directory name and the external utility is found
in that directory, the path will be relative.
The path will be None
if the built-in is not substitutive.
Function(Rc<Function>)
Function
External
External utility
Fields
path: CString
Path to the external utility
The path may not necessarily be absolute. If the $PATH
variable
contains a relative directory name and the external utility is found
in that directory, the path will be relative.
The path may not name an existing executable file, either. If the command name contains a slash, the name is immediately regarded as a path to an external utility, regardless of whether the named external utility actually exists.
Trait Implementations§
impl Eq for Target
impl StructuralPartialEq for Target
Auto Trait Implementations§
impl Freeze for Target
impl !RefUnwindSafe for Target
impl !Send for Target
impl !Sync for Target
impl Unpin for Target
impl !UnwindSafe for Target
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more