Quotable

Enum Quotable 

Source
pub enum Quotable<'a> {
    Bytes(&'a [u8]),
    Text(&'a str),
}
Expand description

A string of bytes that can be quoted/escaped.

This is used by many methods in this crate as a generic Into<Quotable> constraint. Why not accept AsRef<[u8]> instead? The ergonomics of that approach were not so good. For example, quoting OsString/OsStr and PathBuf/Path didn’t work in a natural way.

Variants§

§

Bytes(&'a [u8])

§

Text(&'a str)

Trait Implementations§

Source§

impl<'a> From<&'a [u8]> for Quotable<'a>

Source§

fn from(source: &'a [u8]) -> Quotable<'a>

Converts to this type from the input type.
Source§

impl<'a, const N: usize> From<&'a [u8; N]> for Quotable<'a>

Source§

fn from(source: &'a [u8; N]) -> Quotable<'a>

Converts to this type from the input type.
Source§

impl<'a> From<&'a BStr> for Quotable<'a>

Source§

fn from(source: &'a BStr) -> Quotable<'a>

Converts to this type from the input type.
Source§

impl<'a> From<&'a BString> for Quotable<'a>

Source§

fn from(source: &'a BString) -> Quotable<'a>

Converts to this type from the input type.
Source§

impl<'a> From<&'a OsStr> for Quotable<'a>

Source§

fn from(source: &'a OsStr) -> Quotable<'a>

Converts to this type from the input type.
Source§

impl<'a> From<&'a OsString> for Quotable<'a>

Source§

fn from(source: &'a OsString) -> Quotable<'a>

Converts to this type from the input type.
Source§

impl<'a> From<&'a Path> for Quotable<'a>

Source§

fn from(source: &'a Path) -> Quotable<'a>

Converts to this type from the input type.
Source§

impl<'a> From<&'a PathBuf> for Quotable<'a>

Source§

fn from(source: &'a PathBuf) -> Quotable<'a>

Converts to this type from the input type.
Source§

impl<'a> From<&'a String> for Quotable<'a>

Source§

fn from(source: &'a String) -> Quotable<'a>

Converts to this type from the input type.
Source§

impl<'a> From<&'a Vec<u8>> for Quotable<'a>

Source§

fn from(source: &'a Vec<u8>) -> Quotable<'a>

Converts to this type from the input type.
Source§

impl<'a> From<&'a str> for Quotable<'a>

Source§

fn from(source: &'a str) -> Quotable<'a>

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a> Freeze for Quotable<'a>

§

impl<'a> RefUnwindSafe for Quotable<'a>

§

impl<'a> Send for Quotable<'a>

§

impl<'a> Sync for Quotable<'a>

§

impl<'a> Unpin for Quotable<'a>

§

impl<'a> UnwindSafe for Quotable<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> QuoteExt for T
where T: ?Sized,

Source§

fn push_quoted<'q, Q, S>(&mut self, _q: Q, s: S)
where Q: QuoteInto<T>, S: Into<Quotable<'q>>,

Source§

impl<'a, S, OUT> QuoteRefExt<OUT> for S
where OUT: Default, S: Into<Quotable<'a>>,

Source§

fn quoted<Q>(self, _q: Q) -> OUT
where Q: Quote<OUT>,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.