use std::fmt::Debug;
use async_trait::async_trait;
use r3bl_rs_utils_core::*;
use crate::*;
#[async_trait]
pub trait Component<S, A>
where
S: Default + Clone + PartialEq + Debug + Sync + Send,
A: Default + Clone + Sync + Send,
{
fn get_id(&self) -> FlexBoxIdType;
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 SurfaceRenderer<S, A>
where
S: Default + Clone + PartialEq + Debug + Sync + Send,
A: Default + Clone + Sync + Send,
{
async fn render_in_surface(&mut self, args: GlobalScopeArgs<'_, S, A>, surface: &mut Surface) -> CommonResult<()>;
}