pub struct RenderRaw<S>(pub S)
where
S: AsRef<str>;
Expand description
Wraps an AsRef<str>
, rendering it without escaping.
When rendered, the value will be written to the output buffer directly without being escaped.
Consider using the raw!
macro instead of constructing this type manually.
Example
Using this struct is equivalent to writing to the output buffer directly using
push_str
instead of escaping using
escape
.
struct Raw<'a>(&'a str);
impl Render for Raw<'_> {
#[inline]
fn render(self, buf: &mut Buffer) {
// escape(self.0, buf);
buf.push_str(self.0); // not escaped
}
}
let s = render!(Raw("\""));
assert_eq!(s, "\"");
assert_ne!(s, """);
Tuple Fields§
§0: S
The value to write without escaping.