1use std::fmt;
2
3#[derive(Clone, Debug, Default)]
13pub struct Html(String);
14
15impl Html {
16 pub fn new(raw_html: impl Into<String>) -> Self { Html(raw_html.into()) }
18
19 pub fn into_string(self) -> String { self.0 }
21
22 pub fn as_str(&self) -> &str { &self.0 }
24}
25
26impl fmt::Display for Html {
27 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
28 f.write_str(&self.0)
29 }
30}
31
32impl From<String> for Html {
33 fn from(s: String) -> Self { Html(s) }
34}
35
36impl From<&str> for Html {
37 fn from(s: &str) -> Self { Html(s.to_owned()) }
38}
39
40#[cfg(feature = "maud")]
41impl From<maud::Markup> for Html {
42 fn from(m: maud::Markup) -> Self { Html(m.into_string()) }
43}