pub struct ProcessResult<T> { /* private fields */ }Expand description
The captured result of running a process to completion.
T is the standard-output payload: String for the text helpers
(output_string) or Vec<u8> for the raw-bytes helper (output_bytes).
Standard error is always captured as text. A non-zero exit code is not
treated as an error on its own — inspect exit_code or
call ensure_success.
Implementations§
Source§impl<T> ProcessResult<T>
impl<T> ProcessResult<T>
Sourcepub fn into_stdout(self) -> T
pub fn into_stdout(self) -> T
Consume the result and return just the captured standard output.
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Whether the process exited with code 0.
Sourcepub fn ensure_success(self) -> Result<ProcessResult<T>, Error>
pub fn ensure_success(self) -> Result<ProcessResult<T>, Error>
Return self unchanged when the run succeeded, otherwise the matching
error: Error::Timeout if the run was killed by its deadline (checked
first — a timed-out run has no meaningful exit code), else
Error::Exit for a non-zero exit, carrying the code and (truncated)
standard error.
Trait Implementations§
Source§impl<T> Clone for ProcessResult<T>where
T: Clone,
impl<T> Clone for ProcessResult<T>where
T: Clone,
Source§fn clone(&self) -> ProcessResult<T>
fn clone(&self) -> ProcessResult<T>
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 moreSource§impl<T> Debug for ProcessResult<T>where
T: Debug,
impl<T> Debug for ProcessResult<T>where
T: Debug,
Source§impl<T> PartialEq for ProcessResult<T>where
T: PartialEq,
impl<T> PartialEq for ProcessResult<T>where
T: PartialEq,
Source§fn eq(&self, other: &ProcessResult<T>) -> bool
fn eq(&self, other: &ProcessResult<T>) -> bool
Tests for
self and other values to be equal, and is used by ==.impl<T> Eq for ProcessResult<T>where
T: Eq,
impl<T> StructuralPartialEq for ProcessResult<T>
Auto Trait Implementations§
impl<T> Freeze for ProcessResult<T>where
T: Freeze,
impl<T> RefUnwindSafe for ProcessResult<T>where
T: RefUnwindSafe,
impl<T> Send for ProcessResult<T>where
T: Send,
impl<T> Sync for ProcessResult<T>where
T: Sync,
impl<T> Unpin for ProcessResult<T>where
T: Unpin,
impl<T> UnsafeUnpin for ProcessResult<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for ProcessResult<T>where
T: UnwindSafe,
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