Function shlex::quote

source ·
pub fn quote(in_str: &str) -> Cow<'_, str>
👎Deprecated since 1.3.0: replace with try_quote(str)? to avoid nul byte danger
Expand description

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

Uses default settings except that nul bytes are passed through, which may be dangerous, leading to this function being deprecated.

Equivalent to Quoter::new().allow_nul(true).quote(in_str).unwrap().

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

The bytes equivalent is bytes::quote.