fix: take care of clippy warnings and add test image
This commit is contained in:
parent
24ebca3e8d
commit
816602fb2e
7 changed files with 37 additions and 36 deletions
|
@ -1,21 +1,21 @@
|
|||
use rpl::instructions::{FilterInstruction, Instruction};
|
||||
|
||||
use crate::{value::DynamicValue, Executor};
|
||||
use crate::value::Dynamic;
|
||||
mod instructions;
|
||||
|
||||
pub struct DebugExecutor;
|
||||
pub struct Executor;
|
||||
|
||||
impl Executor for DebugExecutor {
|
||||
fn execute(instruction: Instruction, input: Option<DynamicValue>) -> Option<DynamicValue> {
|
||||
impl crate::Executor for Executor {
|
||||
fn execute(instruction: Instruction, input: Option<Dynamic>) -> Option<Dynamic> {
|
||||
match instruction {
|
||||
Instruction::Read(read_instruction) => Some(DynamicValue::Image(
|
||||
instructions::read::read(read_instruction),
|
||||
)),
|
||||
Instruction::Read(read_instruction) => {
|
||||
Some(Dynamic::Image(instructions::read::read(read_instruction)))
|
||||
}
|
||||
Instruction::Write(write_instruction) => {
|
||||
instructions::write::write(
|
||||
write_instruction,
|
||||
match input {
|
||||
Some(DynamicValue::Image(img)) => img,
|
||||
Some(Dynamic::Image(ref img)) => img,
|
||||
_ => panic!("awawwawwa"),
|
||||
},
|
||||
);
|
||||
|
@ -25,9 +25,9 @@ impl Executor for DebugExecutor {
|
|||
Instruction::Blend(_) => todo!(),
|
||||
Instruction::Noise(_) => todo!(),
|
||||
Instruction::Filter(filter_instruction) => match filter_instruction {
|
||||
FilterInstruction::Invert => Some(DynamicValue::Image(
|
||||
FilterInstruction::Invert => Some(Dynamic::Image(
|
||||
instructions::filters::invert::invert(match input {
|
||||
Some(DynamicValue::Image(img)) => img,
|
||||
Some(Dynamic::Image(img)) => img,
|
||||
_ => panic!("invalid value type for invert"),
|
||||
}),
|
||||
)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue