wip: more edn rendering setup

This commit is contained in:
🪞👃🪞 2025-01-05 04:48:01 +01:00
parent 174a7ee614
commit f1b3fc0040
10 changed files with 85 additions and 47 deletions

View file

@ -3,7 +3,9 @@ use std::sync::{Arc, Mutex, RwLock};
/// Handle input
pub trait Handle<E: Engine>: Send + Sync {
fn handle (&mut self, context: &E::Input) -> Perhaps<E::Handled>;
fn handle (&mut self, _input: &E::Input) -> Perhaps<E::Handled> {
Ok(None)
}
}
/// Current input state

View file

@ -36,11 +36,11 @@ impl<'a, E: Engine> Content<E> for Box<dyn Render<E> + Send + Sync + 'a> {
impl<E: Engine> Content<E> for &(dyn Render<E> + '_) {
fn content (&self) -> impl Render<E> { self }
}
pub struct Thunk<E: Engine, T: Content<E>, F: Fn()->T + Send + Sync>(F, PhantomData<E>);
impl<E: Engine, T: Content<E>, F: Fn()->T + Send + Sync> Thunk<E, T, F> {
pub struct Thunk<E: Engine, T: Render<E>, F: Fn()->T + Send + Sync>(F, PhantomData<E>);
impl<E: Engine, T: Render<E>, F: Fn()->T + Send + Sync> Thunk<E, T, F> {
pub fn new (thunk: F) -> Self { Self(thunk, Default::default()) }
}
impl<E: Engine, T: Content<E>, F: Fn()->T + Send + Sync> Content<E> for Thunk<E, T, F> {
impl<E: Engine, T: Render<E>, F: Fn()->T + Send + Sync> Content<E> for Thunk<E, T, F> {
fn content (&self) -> impl Render<E> { (self.0)() }
}
impl<E: Engine, T: Content<E>> Content<E> for &T {