use std::fmt::{Debug, Display};
use async_trait::async_trait;
use r3bl_rs_utils_core::*;
use crate::*;
#[async_trait]
pub trait Component<S, A>
where
S: Default + Display + Clone + PartialEq + Debug + Sync + Send,
A: Default + Display + Clone + Sync + Send,
{
async fn render(
&mut self,
args: ComponentScopeArgs<'_, S, A>,
current_box: &FlexBox,
) -> CommonResult<RenderPipeline>;
async fn handle_event(
&mut self,
args: ComponentScopeArgs<'_, S, A>,
input_event: &InputEvent,
) -> CommonResult<EventPropagation>;
}
#[async_trait]
pub trait SurfaceRunnable<S, A>
where
S: Default + Display + Clone + PartialEq + Debug + Sync + Send,
A: Default + Display + Clone + Sync + Send,
{
async fn run_on_surface(
&mut self,
args: GlobalScopeArgs<'_, S, A>,
surface: &mut Surface,
) -> CommonResult<()>;
}