diff options
author | 2024-12-02 21:49:18 +0000 | |
---|---|---|
committer | 2024-12-02 21:49:18 +0000 | |
commit | 547e7c6a304822914816efc5a0a8b386bc358296 (patch) | |
tree | 0486db051f4791f96ff48b9e079714a94d742db3 | |
parent | 2dae043e8ffcb030699f3523568544676e370b53 (diff) | |
download | peanuts-547e7c6a304822914816efc5a0a8b386bc358296.tar.gz peanuts-547e7c6a304822914816efc5a0a8b386bc358296.tar.bz2 peanuts-547e7c6a304822914816efc5a0a8b386bc358296.zip |
use trait generic in push_child element builder method
-rw-r--r-- | src/element.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/element.rs b/src/element.rs index 1f78419..3f4bee3 100644 --- a/src/element.rs +++ b/src/element.rs @@ -482,8 +482,8 @@ impl ElementBuilder { self } - pub fn push_child(mut self, child: ElementBuilder) -> Self { - self.content.push(ContentBuilder::Element(child)); + pub fn push_child(mut self, child: impl IntoElement) -> Self { + self.content.push(ContentBuilder::Element(child.builder())); 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 { self.push_child(child) } else { |