cotis 0.1.0-alpha

Modular Rust UI framework core
Documentation
/// A trait meant to signal what [`layout managers`](crate::layout::LayoutManager) the render engine is compatible with
///
/// Tip: Instead of specifying a concrete type for `Layout` use a generic type with the necessary traits for the engine to work
pub trait RenderCompatibleWith<Layout> {
    fn init(&mut self, layout_manager: &mut Layout);
}

/// A trait meant to signal that the renderer is capable of drawing frames synchronously
///
/// If your render engine requires async code to function consider using [`cotisRenderAsync`](CotisRendererAsync)
/// Tip: you probably can implement [`cotisRenderAsync`](CotisRendererAsync) as well with the same logic.
pub trait CotisRenderer<RenderCommandType> {
    fn draw_frame(&mut self, render_commands: impl Iterator<Item = RenderCommandType>);
}

/// A trait meant to signal that the renderer is capable of drawing frames asynchronously
///
/// If your render engine requires sync code to function consider using [`cotisRender`](CotisRenderer)
pub trait CotisRendererAsync<RenderCommandType> {
    #[allow(async_fn_in_trait)]
    async fn draw_frame(&mut self, render_commands: impl Iterator<Item = RenderCommandType>);
}