Trait Unquote

Source
pub trait Unquote {
    // Required method
    fn write_unquoted<W: Write>(&self, w: &mut W) -> Result<bool, Error>;

    // Provided method
    fn unquote(&self) -> (String, bool) { ... }
}
Expand description

Removing quotes from syntax without performing expansion.

This trail will be useful only in a limited number of use cases. In the normal word expansion process, quote removal is done after other kinds of expansions like parameter expansion, so this trait is not used.

Required Methods§

Source

fn write_unquoted<W: Write>(&self, w: &mut W) -> Result<bool, Error>

Converts self to a string with all quotes removed and writes to w.

Provided Methods§

Source

fn unquote(&self) -> (String, bool)

Converts self to a string with all quotes removed.

Returns a tuple of a string and a bool. The string is an unquoted version of self. The bool tells whether there is any quotes contained in self.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T: Unquote> Unquote for [T]

Implementors§

Source§

impl Unquote for BackquoteUnit

Source§

impl Unquote for EscapeUnit

Converts an escape unit into the string represented by the escape sequence.

Produces an empty string if the escape unit does not represent a valid Unicode scalar value.

Source§

impl Unquote for TextUnit

Source§

impl Unquote for WordUnit

Source§

impl Unquote for BracedParam

Source§

impl Unquote for EscapedString

Converts an escaped string into the string represented by the escape sequences.

Escape units that do not represent valid Unicode scalar values are ignored.

Source§

impl Unquote for Switch

Source§

impl Unquote for Text

Source§

impl Unquote for Trim

Source§

impl Unquote for Word