[−][src]Struct ansi_to_html::Esc
A formatting wrapper for escaping HTML in a string.
The Display
implementation replaces
&
with&
<
with<
>
with>
"
with"
'
with'
Esc
is lazy: If you don't use it, it does nothing. Also, it
doesn't allocate a String
unless you call .to_string()
.
Examples
In a format!
-like macro:
assert_eq!(format!("{}", Esc("<h1>")).as_str(), "<h1>");
Convert it to a String directly:
assert_eq!(Esc("<h1>").to_string().as_str(), "<h1>");
Trait Implementations
impl<T: Clone + AsRef<str>> Clone for Esc<T>
[src]
impl<T: Copy + AsRef<str>> Copy for Esc<T>
[src]
impl<T: Debug + AsRef<str>> Debug for Esc<T>
[src]
impl<T: AsRef<str>> Display for Esc<T>
[src]
impl<T: Eq + AsRef<str>> Eq for Esc<T>
[src]
impl<T: PartialEq + AsRef<str>> PartialEq<Esc<T>> for Esc<T>
[src]
impl<T: AsRef<str>> StructuralEq for Esc<T>
[src]
impl<T: AsRef<str>> StructuralPartialEq for Esc<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Esc<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Esc<T> where
T: Send,
T: Send,
impl<T> Sync for Esc<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Esc<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Esc<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,