From 4e2d4662d1614487cb4e927edc9aaa51f30895ea Mon Sep 17 00:00:00 2001 From: Leo dev Date: Fri, 30 Jan 2026 23:25:33 +0100 Subject: [PATCH] Display to rsx --- src/frontend.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/frontend.rs b/src/frontend.rs index 23c2124..1bb3fa5 100644 --- a/src/frontend.rs +++ b/src/frontend.rs @@ -2,6 +2,7 @@ use std::sync::Arc; use crate::{ component::{Context, Scope}, + render::Point, state::HookDependency, View, }; @@ -85,3 +86,13 @@ impl ToRsx for &Rsx { Rsx(self.0.clone()) } } + +impl ToRsx for T { + fn to_rsx(&self) -> Rsx { + let s = self.to_string(); + Rsx(vec![RsxScope::Static(Arc::new(move |scope| { + let s = s.clone(); + scope.view(Arc::new(move |ctx| ctx.draw_text(Point { x: 0, y: 0 }, &s))) + }))]) + } +}