wip: dsl: continuing to offload to Ast

This commit is contained in:
🪞👃🪞 2025-05-26 23:39:02 +03:00
parent e9d4c7e0bc
commit 08a8dff93d
4 changed files with 19 additions and 20 deletions

View file

@ -23,14 +23,14 @@ impl InputLayers {
self.0.push(InputLayer(condition, binding));
self
}
pub fn handle <S, I, O: Command<S>> (&self, state: &mut S, input: I) -> Perhaps<O> {
pub fn handle <S: Eval<Ast, bool>, I, O: Command<S>> (&self, state: &mut S, input: I) -> Perhaps<O> {
InputHandle(state, self.0.as_slice()).try_eval(input)
}
}
pub struct InputHandle<'a, S>(&'a mut S, &'a [InputLayer]);
impl<'a, S, I, O: Command<S>> Eval<I, O> for InputHandle<'a, S> {
impl<'a, S: Eval<Ast, bool>, I, O: Command<S>> Eval<I, O> for InputHandle<'a, S> {
fn try_eval (&self, input: I) -> Perhaps<O> {
let Self(state, layers) = self;
for InputLayer(condition, binding) in layers.iter() {