Struct format_xml::EscapeText
source · [−]#[repr(transparent)]pub struct EscapeText<T: ?Sized> { /* private fields */ }
Expand description
Escapes <
, &
, >
when it appears in the formatted string.
Examples
fn check(input: &str, escaped: &str) {
let mut buf = String::new();
let mut writer = format_xml::EscapeText::wrap(&mut buf);
write!(writer, "{}", input).unwrap();
assert_eq!(buf, escaped);
}
check("", "");
check(" ", " ");
check("&", "&");
check(" &", " &");
check("& ", "& ");
check("hello", "hello");
check("'world'", "\'world\'");
check("pre<script>post", "pre<script>post");
check("&<>\"\'", "&<>\"\'");
check("&a'b<c>", "&a\'b<c>");
Implementations
sourceimpl<T: ?Sized + Write> EscapeText<T>
impl<T: ?Sized + Write> EscapeText<T>
pub fn wrap(v: &mut T) -> &mut EscapeText<T>
Trait Implementations
sourceimpl<T> From<T> for EscapeText<T>
impl<T> From<T> for EscapeText<T>
Auto Trait Implementations
impl<T: ?Sized> RefUnwindSafe for EscapeText<T> where
T: RefUnwindSafe,
impl<T: ?Sized> Send for EscapeText<T> where
T: Send,
impl<T: ?Sized> Sync for EscapeText<T> where
T: Sync,
impl<T: ?Sized> Unpin for EscapeText<T> where
T: Unpin,
impl<T: ?Sized> UnwindSafe for EscapeText<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more