pub enum Type {
Special,
Mandatory,
Elective,
Extension,
Substitutive,
}Expand description
Types of built-in utilities
Variants§
Special
Special built-in
Special built-in utilities are built-ins that are defined in POSIX XCU section 2.15.
They are treated differently from other built-ins.
Especially, special built-ins are found in the first stage of command
search without the $PATH search and cannot be overridden by functions
or external utilities.
Many errors in special built-ins force the shell to exit.
Mandatory
Standard utility that can be used without $PATH search
Mandatory built-ins are utilities that are listed in POSIX XCU section 1.7. In POSIX, they are called “intrinsic utilities”.
Like special built-ins, mandatory built-ins are not subject to $PATH
in command search; They are always found regardless of whether there is
a corresponding external utility in $PATH. However, mandatory
built-ins can still be overridden by functions.
We call them “mandatory” because POSIX effectively requires them to be built into the shell.
Elective
Non-portable built-in that can be used without $PATH search
Elective built-ins are built-ins that are listed in step 1b of Command Search and Execution in POSIX XCU section 2.9.1.4. They are very similar to mandatory built-ins, but their behavior is not specified by POSIX, so they are not portable. They cannot be used when the (TODO TBD) option is set.
We call them “elective” because it is up to the shell whether to implement them.
Extension
Non-conforming extension
Extension built-ins are non-conformant extensions to the POSIX shell.
Like elective built-ins, they can be executed without $PATH search
finding a corresponding external utility. However, since this behavior
does not conform to Command
Search and Execution
in POSIX XCU section 2.9.1.4, they cannot be used when the (TODO TBD)
option is set.
Substitutive
Built-in that works like a standalone utility
A substitutive built-in is a built-in that is executed instead of an
external utility to minimize invocation overhead. Since a substitutive
built-in behaves just as if it were an external utility, it must be
found in $PATH in order to be executed.
Trait Implementations§
impl Copy for Type
impl Eq for Type
impl StructuralPartialEq for Type
Auto Trait Implementations§
impl Freeze for Type
impl RefUnwindSafe for Type
impl Send for Type
impl Sync for Type
impl Unpin for Type
impl UnwindSafe for Type
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