rama_http/protocols/html/
either_impls.rs1use super::core::IntoHtml;
8
9macro_rules! impl_into_html_either {
10 ($id:ident, $($param:ident),+ $(,)?) => {
11 impl<$($param,)+> IntoHtml for ::rama_core::combinators::$id<$($param,)+>
12 where
13 $($param: IntoHtml,)+
14 {
15 #[inline]
16 fn into_html(self) -> impl IntoHtml {
17 match self {
18 $(
19 Self::$param(value) => ::rama_core::combinators::$id::$param(value.into_html()),
20 )+
21 }
22 }
23
24 #[inline]
25 fn escape_and_write(self, buf: &mut String) {
26 match self {
27 $( Self::$param(value) => value.escape_and_write(buf), )+
28 }
29 }
30
31 #[inline]
32 fn size_hint(&self) -> usize {
33 match self {
34 $( Self::$param(value) => value.size_hint(), )+
35 }
36 }
37 }
38 };
39}
40
41::rama_core::combinators::impl_either!(impl_into_html_either);