mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
wip: more edn rendering setup
This commit is contained in:
parent
174a7ee614
commit
f1b3fc0040
10 changed files with 85 additions and 47 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue