mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 03:36:42 +01:00
wip: dsl: continuing to offload to Ast
This commit is contained in:
parent
e9d4c7e0bc
commit
08a8dff93d
4 changed files with 19 additions and 20 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue