From 9201b03d9e6ca49b9031c4471235ead4a704d9c1 Mon Sep 17 00:00:00 2001 From: MultisampledNight Date: Thu, 11 Jan 2024 14:10:44 +0100 Subject: [PATCH] style: drop Instruction suffix from instructions --- crates/executor/src/debug/mod.rs | 10 +++++----- crates/rpl/src/instructions/mod.rs | 16 ++++++++-------- crates/rpl/src/lib.rs | 4 ++-- testfiles/{bare.rpl => bare.ron} | 0 testfiles/{invert.rpl => invert.ron} | 0 5 files changed, 15 insertions(+), 15 deletions(-) rename testfiles/{bare.rpl => bare.ron} (100%) rename testfiles/{invert.rpl => invert.ron} (100%) diff --git a/crates/executor/src/debug/mod.rs b/crates/executor/src/debug/mod.rs index 8cde85b..b7524d3 100644 --- a/crates/executor/src/debug/mod.rs +++ b/crates/executor/src/debug/mod.rs @@ -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"), - }), - )), + }, + ))), }, } } diff --git a/crates/rpl/src/instructions/mod.rs b/crates/rpl/src/instructions/mod.rs index 9fb8a56..76ecc22 100644 --- a/crates/rpl/src/instructions/mod.rs +++ b/crates/rpl/src/instructions/mod.rs @@ -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, } diff --git a/crates/rpl/src/lib.rs b/crates/rpl/src/lib.rs index 0e5011e..657b07d 100644 --- a/crates/rpl/src/lib.rs +++ b/crates/rpl/src/lib.rs @@ -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 diff --git a/testfiles/bare.rpl b/testfiles/bare.ron similarity index 100% rename from testfiles/bare.rpl rename to testfiles/bare.ron diff --git a/testfiles/invert.rpl b/testfiles/invert.ron similarity index 100% rename from testfiles/invert.rpl rename to testfiles/invert.ron