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§
Source§impl<T: ?Sized + Write> EscapeText<T>
impl<T: ?Sized + Write> EscapeText<T>
pub fn wrap(v: &mut T) -> &mut EscapeText<T>
Trait Implementations§
Source§impl<T> From<T> for EscapeText<T>
impl<T> From<T> for EscapeText<T>
Auto Trait Implementations§
impl<T> Freeze for EscapeText<T>
impl<T> RefUnwindSafe for EscapeText<T>where
T: RefUnwindSafe + ?Sized,
impl<T> Send for EscapeText<T>
impl<T> Sync for EscapeText<T>
impl<T> Unpin for EscapeText<T>
impl<T> UnwindSafe for EscapeText<T>where
T: UnwindSafe + ?Sized,
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