From aa8c4100b05c38770719c2ce8bf1d29336e72952 Mon Sep 17 00:00:00 2001 From: Manuel Cillero Date: Wed, 12 Aug 2026 23:57:31 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20(base):=20A=C3=B1ade=20conversi?= =?UTF-8?q?=C3=B3n=20de=20Lc=20a=20Child/ChildOp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/component/html.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/base/component/html.rs b/src/base/component/html.rs index 9bb74331..7098c756 100644 --- a/src/base/component/html.rs +++ b/src/base/component/html.rs @@ -100,3 +100,18 @@ impl Html { (self.0)(cx) } } + +impl From for Child { + /// Convierte un texto traducible [`Lc`] en un [`Child`], envolviéndolo en un [`Html`] que lo + /// resuelve con el `cx` del ciclo de renderizado. + fn from(label: Lc) -> Self { + Child::with(Html::with(move |cx| label.using(cx))) + } +} + +impl From for ChildOp { + /// Convierte un [`Lc`] en [`ChildOp::Add`]; equivale a `ChildOp::Add(Child::from(label))`. + fn from(label: Lc) -> Self { + ChildOp::Add(Child::from(label)) + } +}