parent
9ff5ff4f2c
commit
90e0f1ccbd
1 changed files with 3 additions and 15 deletions
|
@ -122,23 +122,11 @@ impl<'a, T: Render + ?Sized> RenderOnce for &'a T {
|
||||||
|
|
||||||
/// A wrapper that renders the inner value without escaping.
|
/// A wrapper that renders the inner value without escaping.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct PreEscaped<T>(pub T);
|
pub struct PreEscaped<T: AsRef<str>>(pub T);
|
||||||
|
|
||||||
impl<T: fmt::Display> Render for PreEscaped<T> {
|
impl<T: AsRef<str>> Render for PreEscaped<T> {
|
||||||
default fn render_to(&self, w: &mut String) {
|
|
||||||
let _ = write!(w, "{}", self.0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Render for PreEscaped<String> {
|
|
||||||
fn render_to(&self, w: &mut String) {
|
fn render_to(&self, w: &mut String) {
|
||||||
w.push_str(&self.0);
|
w.push_str(self.0.as_ref());
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Render for PreEscaped<&'a str> {
|
|
||||||
fn render_to(&self, w: &mut String) {
|
|
||||||
w.push_str(self.0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue