use trait generic in push_child element builder method

This commit is contained in:
cel 🌸 2024-12-02 21:49:18 +00:00
parent 2dae043e8f
commit 547e7c6a30
1 changed files with 3 additions and 3 deletions

View File

@ -482,8 +482,8 @@ impl ElementBuilder {
self self
} }
pub fn push_child(mut self, child: ElementBuilder) -> Self { pub fn push_child(mut self, child: impl IntoElement) -> Self {
self.content.push(ContentBuilder::Element(child)); self.content.push(ContentBuilder::Element(child.builder()));
self self
} }
@ -513,7 +513,7 @@ impl ElementBuilder {
} }
} }
pub fn push_child_opt(self, child: Option<ElementBuilder>) -> Self { pub fn push_child_opt(self, child: Option<impl IntoElement>) -> Self {
if let Some(child) = child { if let Some(child) = child {
self.push_child(child) self.push_child(child)
} else { } else {