refactor: device abstraction, layout components

This commit is contained in:
🪞👃🪞 2024-06-12 16:55:57 +03:00
parent d330d31ce4
commit 788dc1ccde
21 changed files with 1144 additions and 1166 deletions

21
src/device/chain.rs Normal file
View file

@ -0,0 +1,21 @@
use crate::prelude::*;
pub struct Chain {
name: String,
devices: Vec<Box<dyn Device>>
}
impl Chain {
pub fn new (name: &str, devices: Vec<Box<dyn Device>>) -> Result<DynamicDevice<Self>, Box<dyn Error>> {
Ok(DynamicDevice::new(render, handle, |_|{}, Self {
name: name.into(),
devices
}))
}
}
pub fn render (state: &Chain, buf: &mut Buffer, area: Rect) {}
pub fn handle (state: &mut Chain, event: &EngineEvent) -> Result<(), Box<dyn Error>> {
Ok(())
}