pub struct Result { /* private fields */ }Expand description
Result of built-in utility execution
The result type contains an exit status and optional flags that may affect the behavior of the shell following the built-in execution.
Implementations§
Source§impl Result
impl Result
Sourcepub const fn new(exit_status: ExitStatus) -> Self
pub const fn new(exit_status: ExitStatus) -> Self
Creates a new result.
Sourcepub const fn with_exit_status_and_divert(
exit_status: ExitStatus,
divert: Result,
) -> Self
pub const fn with_exit_status_and_divert( exit_status: ExitStatus, divert: Result, ) -> Self
Creates a new result with a Divert.
Sourcepub const fn exit_status(&self) -> ExitStatus
pub const fn exit_status(&self) -> ExitStatus
Returns the exit status of this result.
The return value is the argument to the previous invocation of
new or set_exit_status.
Sourcepub fn set_exit_status(&mut self, exit_status: ExitStatus)
pub fn set_exit_status(&mut self, exit_status: ExitStatus)
Sets the exit status of this result.
See exit_status.
Sourcepub const fn divert(&self) -> Result
pub const fn divert(&self) -> Result
Returns an optional Divert to be taken.
The return value is the argument to the previous invocation of
set_divert. The default is Continue(()).
Sourcepub fn set_divert(&mut self, divert: Result)
pub fn set_divert(&mut self, divert: Result)
Sourcepub const fn should_retain_redirs(&self) -> bool
pub const fn should_retain_redirs(&self) -> bool
Tests whether the caller should retain redirections.
Usually, the shell reverts redirections applied to a built-in after
executing it. However, redirections applied to a successful exec
built-in should persist. To make it happen, the exec built-in calls
retain_redirs, and this function returns true.
In that case, the caller of the built-in should take appropriate actions
to preserve the effect of the redirections.
Sourcepub fn retain_redirs(&mut self)
pub fn retain_redirs(&mut self)
Flags that redirections applied to the built-in should persist.
Calling this function makes
should_retain_redirs return true.
clear_redirs cancels the effect of this
function.
Sourcepub fn clear_redirs(&mut self)
pub fn clear_redirs(&mut self)
Cancels the effect of retain_redirs.
Trait Implementations§
Source§impl From<ExitStatus> for Result
impl From<ExitStatus> for Result
Source§fn from(exit_status: ExitStatus) -> Self
fn from(exit_status: ExitStatus) -> Self
impl Copy for Result
impl Eq for Result
impl StructuralPartialEq for Result
Auto Trait Implementations§
impl Freeze for Result
impl RefUnwindSafe for Result
impl Send for Result
impl Sync for Result
impl Unpin for Result
impl UnwindSafe for Result
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