Struct format_xml::EscapeAttrValue
source · [−]#[repr(transparent)]pub struct EscapeAttrValue<T: ?Sized> { /* private fields */ }
Expand description
Escapes <
, &
, >
, '
, "
when it appears in the formatted string.
Examples
#[track_caller]
fn check(input: &str, escaped: &str) {
let mut buf = String::new();
let mut writer = format_xml::EscapeAttrValue::wrap(&mut buf);
writer.write_str(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> EscapeAttrValue<T>
impl<T: ?Sized + Write> EscapeAttrValue<T>
pub fn wrap(v: &mut T) -> &mut EscapeAttrValue<T>
Trait Implementations
sourceimpl<T> From<T> for EscapeAttrValue<T>
impl<T> From<T> for EscapeAttrValue<T>
Auto Trait Implementations
impl<T: ?Sized> RefUnwindSafe for EscapeAttrValue<T> where
T: RefUnwindSafe,
impl<T: ?Sized> Send for EscapeAttrValue<T> where
T: Send,
impl<T: ?Sized> Sync for EscapeAttrValue<T> where
T: Sync,
impl<T: ?Sized> Unpin for EscapeAttrValue<T> where
T: Unpin,
impl<T: ?Sized> UnwindSafe for EscapeAttrValue<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