style: drop Instruction suffix from instructions

This commit is contained in:
MultisampledNight 2024-01-11 14:10:44 +01:00
parent c0dd533d81
commit ccbccfb11b
No known key found for this signature in database
GPG key ID: 6D525AA147CBDAE2
5 changed files with 15 additions and 15 deletions

View file

@ -1,4 +1,4 @@
use rpl::instructions::{FilterInstruction, Instruction};
use rpl::instructions::{Filter, Instruction};
use crate::value::Dynamic;
mod instructions;
@ -25,12 +25,12 @@ impl crate::Executor for Executor {
Instruction::Blend(_) => todo!(),
Instruction::Noise(_) => todo!(),
Instruction::Filter(filter_instruction) => match filter_instruction {
FilterInstruction::Invert => Some(Dynamic::Image(
instructions::filters::invert::invert(match input {
Filter::Invert => Some(Dynamic::Image(instructions::filters::invert::invert(
match input {
Some(Dynamic::Image(img)) => img,
_ => panic!("invalid value type for invert"),
}),
)),
},
))),
},
}
}

View file

@ -7,14 +7,14 @@ pub mod write;
pub enum Instruction {
Read(read::Read),
Write(write::Write),
Math(MathInstruction),
Blend(BlendInstruction),
Noise(NoiseInstruction),
Filter(FilterInstruction),
Math(Math),
Blend(Blend),
Noise(Noise),
Filter(Filter),
}
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug)]
pub enum MathInstruction {
pub enum Math {
Add,
Subtract,
Multiply,
@ -22,7 +22,7 @@ pub enum MathInstruction {
}
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug)]
pub enum BlendInstruction {
pub enum Blend {
Normal,
Multiply,
Additive,
@ -35,13 +35,13 @@ pub enum BlendInstruction {
}
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug)]
pub enum NoiseInstruction {
pub enum Noise {
Perlin,
Simplex,
Voronoi,
}
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug)]
pub enum FilterInstruction {
pub enum Filter {
Invert,
}

View file

@ -20,7 +20,7 @@ mod tests {
use crate::instructions::{
read::{SourceFormat, SourceType},
write::{TargetFormat, TargetType},
MathInstruction,
Math,
};
#[test]
@ -40,7 +40,7 @@ mod tests {
source: SourceType::File("~/example/file.png".into()),
format: SourceFormat::Png
}),
Instruction::Math(MathInstruction::Add),
Instruction::Math(Math::Add),
Instruction::Write(instructions::write::Write {
target: TargetType::File("~/example/out.jpg".into()),
format: TargetFormat::Jpeg