Function shlex::try_quote

source ·
pub fn try_quote(in_str: &str) -> Result<Cow<'_, str>, QuoteError>
Expand description

Given a single word, return a string suitable to encode it as a shell argument.

Uses default settings. The only error that can be returned is QuoteError::Nul.

Equivalent to Quoter::new().quote(in_str).

(That configuration never returns Err, so this function does not panic.)

The bytes equivalent is bytes::try_quote.