pub struct Quoter<'a> { /* private fields */ }Expand description
A utility for quoting a string.
Implementations§
Source§impl<'a> Quoter<'a>
impl<'a> Quoter<'a>
Sourcepub fn new(
data: impl Into<Quotable<'a>>,
options: QuoterOptions<'a>,
) -> Quoter<'a>
pub fn new( data: impl Into<Quotable<'a>>, options: QuoterOptions<'a>, ) -> Quoter<'a>
Create a new instance.
Sourcepub fn is_bareword(&self) -> bool
pub fn is_bareword(&self) -> bool
Return true if the provided string is a bareword.
Sourcepub fn maybe_quote(self) -> String
pub fn maybe_quote(self) -> String
Maybe quote the provided string depending on certain conditions. If it’s already quoted, do nothing. If it requires expansion, use shell-specific quotes. Otherwise quote as normal.
Sourcepub fn quote_expansion(self) -> String
pub fn quote_expansion(self) -> String
Quote the provided string for expansion, substition, etc. This assumes the string is not already quoted.
Sourcepub fn quote(self) -> String
pub fn quote(self) -> String
Quote the provided string. This assumes the string is not already quoted.
Sourcepub fn requires_expansion(&self) -> bool
pub fn requires_expansion(&self) -> bool
Return true if the provided string requires expansion.
Sourcepub fn requires_unquoted(&self) -> bool
pub fn requires_unquoted(&self) -> bool
Return true if the provided string must be unquoted.
Auto Trait Implementations§
impl<'a> Freeze for Quoter<'a>
impl<'a> !RefUnwindSafe for Quoter<'a>
impl<'a> !Send for Quoter<'a>
impl<'a> !Sync for Quoter<'a>
impl<'a> Unpin for Quoter<'a>
impl<'a> UnsafeUnpin for Quoter<'a>
impl<'a> !UnwindSafe for Quoter<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more