forked from katzen-cafe/iowo
30 lines
1 KiB
Rust
30 lines
1 KiB
Rust
use crate::{value::DynamicValue, Executor};
|
|
mod instructions;
|
|
|
|
pub struct DebugExecutor;
|
|
|
|
impl Executor for DebugExecutor {
|
|
fn execute(
|
|
instruction: rpl::instructions::Instruction,
|
|
input: Option<DynamicValue>,
|
|
) -> Option<DynamicValue> {
|
|
match instruction {
|
|
rpl::instructions::Instruction::Read(read_instruction) => Some(DynamicValue::Image(
|
|
instructions::Read::read(read_instruction),
|
|
)),
|
|
rpl::instructions::Instruction::Write(write_instruction) => {
|
|
instructions::Write::write(
|
|
write_instruction,
|
|
match input {
|
|
Some(DynamicValue::Image(img)) => img,
|
|
_ => panic!("awawwawwa"),
|
|
},
|
|
);
|
|
None
|
|
}
|
|
rpl::instructions::Instruction::Math(_) => todo!(),
|
|
rpl::instructions::Instruction::Blend(_) => todo!(),
|
|
rpl::instructions::Instruction::Noise(_) => todo!(),
|
|
}
|
|
}
|
|
}
|