feat: add element macro

This commit is contained in:
Strix 2023-10-14 22:39:16 +02:00
parent c3c599f8b9
commit 44075cee1f
No known key found for this signature in database
GPG key ID: 49B2E37B8915B774

View file

@ -11,6 +11,14 @@ pub struct Element {
pre_text: String, pre_text: String,
} }
#[macro_export]
macro_rules! element {
($el:literal$(, $($content: expr),*)?) => {
Element::new($el)
$($(.append_child($content))*)?
};
}
impl Element { impl Element {
pub fn new<S: Into<String>>(t: S) -> Self { pub fn new<S: Into<String>>(t: S) -> Self {
Element { Element {