Struct cradle::output::StdoutTrimmed
source · [−]pub struct StdoutTrimmed(pub String);
Expand description
Returns what the child process writes to stdout
, interpreted as utf-8,
collected into a string, trimmed of leading and trailing whitespace.
This also suppresses output of the child’s stdout
to the parent’s stdout
. (Which would be the default when not using StdoutTrimmed
as the return value.)
It’s recommended to pattern-match to get to the inner String
.
This will make sure that the return type can be inferred.
Here’s an example:
use std::path::Path;
use cradle::prelude::*;
let StdoutTrimmed(output) = run_output!(%"which ls");
assert!(Path::new(&output).exists());
Tuple Fields
0: String
Trait Implementations
sourceimpl Clone for StdoutTrimmed
impl Clone for StdoutTrimmed
sourcefn clone(&self) -> StdoutTrimmed
fn clone(&self) -> StdoutTrimmed
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for StdoutTrimmed
impl Debug for StdoutTrimmed
sourceimpl Output for StdoutTrimmed
impl Output for StdoutTrimmed
sourcefn from_child_output(
config: &Config,
result: &ChildOutput
) -> Result<Self, Error>
fn from_child_output(
config: &Config,
result: &ChildOutput
) -> Result<Self, Error>
Converts ChildOutput
s
from running a child process into values of the Output
type.
This is an internal function that should be ignored. Read more
sourceimpl PartialEq<StdoutTrimmed> for StdoutTrimmed
impl PartialEq<StdoutTrimmed> for StdoutTrimmed
sourcefn eq(&self, other: &StdoutTrimmed) -> bool
fn eq(&self, other: &StdoutTrimmed) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &StdoutTrimmed) -> bool
fn ne(&self, other: &StdoutTrimmed) -> bool
This method tests for !=
.
impl StructuralPartialEq for StdoutTrimmed
Auto Trait Implementations
impl RefUnwindSafe for StdoutTrimmed
impl Send for StdoutTrimmed
impl Sync for StdoutTrimmed
impl Unpin for StdoutTrimmed
impl UnwindSafe for StdoutTrimmed
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more