Component params

This commit is contained in:
2026-01-30 19:02:26 +01:00
parent 2799faaa73
commit 1f64b4f6e2
7 changed files with 75 additions and 53 deletions
+3 -9
View File
@@ -7,7 +7,7 @@ use crossterm::{cursor::MoveTo, execute, terminal::Clear};
use crate::{
engine::{commands, CommandExecutor},
prelude::Context,
prelude::{ComponentImpl, Context},
render::Area,
DrawContext, View,
};
@@ -79,10 +79,7 @@ impl Engine for Console {
));
}
fn init<F: Fn(&Arc<Context>) -> View + Send + Sync + 'static>(
&self,
component: F,
) -> Arc<Context> {
fn init<C: ComponentImpl + 'static>(&self, component: C) -> Arc<Context> {
let cx = Context::new(component, self.executor.clone());
cx.refresh();
@@ -102,10 +99,7 @@ impl Engine for Console {
self.executor.clone()
}
fn run<F: Fn(&Arc<Context>) -> View + Send + Sync + 'static>(
&self,
component: F,
) -> crate::Result<()> {
fn run<F: ComponentImpl + 'static>(&self, component: F) -> crate::Result<()> {
let cx = self.init(component);
while self.executor.is_running() {