markdown_composer/
traits.rs1use dyn_clonable::clonable;
4use std::fmt;
5
6pub trait AsFooter {
9 fn as_footer(&self) -> Box<dyn MarkdownElement>;
11}
12
13#[clonable]
15pub trait MarkdownElement: Clone + fmt::Debug {
16 fn render(&self) -> String;
18}
19
20impl<T> MarkdownElement for T
24where
25 T: Clone + fmt::Debug + fmt::Display,
26{
27 fn render(&self) -> String {
28 format!("{}", self)
29 }
30}
31
32impl<'a, T: 'a> From<T> for Box<dyn MarkdownElement + 'a>
34where
35 T: Clone + fmt::Debug + fmt::Display,
36{
37 fn from(value: T) -> Self {
38 Box::new(value)
39 }
40}