1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
//! HTML utilities use crate::Render; use std::fmt::{Result, Write}; /// HTML 5 doctype declaration /// /// ```rust /// # #![feature(proc_macro_hygiene)] /// # use pretty_assertions::assert_eq; /// # use render::html::HTML5Doctype; /// # use render::html; /// # let result = /// html! { /// <> /// <HTML5Doctype /> /// <html> /// <body /> /// </html> /// </> /// }; /// # assert_eq!(result, "<!DOCTYPE html><html><body /></html>"); /// ``` #[derive(Debug)] pub struct HTML5Doctype; impl Render for HTML5Doctype { fn render_into<W: Write>(self, writer: &mut W) -> Result { write!(writer, "<!DOCTYPE html>") } }