From dab8e5108a52f52045c053ec2c391279a2800750 Mon Sep 17 00:00:00 2001
From: Chris Wong <lambda.fairy@gmail.com>
Date: Sat, 17 Dec 2016 13:41:59 +1300
Subject: [PATCH] Add impl Into<String> for PreEscaped

This allows for passing `Markup` values directly to Rouille's
[`Response::html`][1] constructor.

[1]: https://docs.rs/rouille/0.4.1/rouille/struct.Response.html#method.html
---
 maud/src/lib.rs | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/maud/src/lib.rs b/maud/src/lib.rs
index 873e8ca..a9e642c 100644
--- a/maud/src/lib.rs
+++ b/maud/src/lib.rs
@@ -135,10 +135,16 @@ impl<T: AsRef<str>> Render for PreEscaped<T> {
 /// The `html!` macro expands to an expression of this type.
 pub type Markup = PreEscaped<String>;
 
-impl PreEscaped<String> {
-    /// Extracts the inner `String`. This is a synonym for `self.0`.
+impl<T: AsRef<str> + Into<String>> PreEscaped<T> {
+    /// Converts the inner value to a string.
     pub fn into_string(self) -> String {
-        self.0
+        self.0.into()
+    }
+}
+
+impl<T: AsRef<str> + Into<String>> Into<String> for PreEscaped<T> {
+    fn into(self) -> String {
+        self.into_string()
     }
 }