feat: add element macro
This commit is contained in:
parent
c3c599f8b9
commit
44075cee1f
1 changed files with 8 additions and 0 deletions
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue