Struct cradle::Split[][src]

pub struct Split<T: AsRef<str>>(pub T);
Expand description

See the Input implementation for Split below.

Trait Implementations

Splits the contained string by whitespace (using split_whitespace) and uses the resulting words as separate arguments.

use cradle::*;

let StdoutTrimmed(output) = cmd!(Split("echo foo"));
assert_eq!(output, "foo");

let StdoutTrimmed(output) = cmd!(Split(format!("echo {}", 100)));
assert_eq!(output, "100");

Since this is such a common case, cradle also provides a syntactic shortcut for Split, the % symbol:

use cradle::*;

let StdoutTrimmed(output) = cmd!(%"echo foo");
assert_eq!(output, "foo");

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.