(base): Añade conversión de Lc a Child/ChildOp

This commit is contained in:
Manuel Cillero 2026-08-12 23:57:31 +02:00
parent be10dd28a1
commit aa8c4100b0

View file

@ -100,3 +100,18 @@ impl Html {
(self.0)(cx)
}
}
impl From<Lc> 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<Lc> 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))
}
}