mirror of
https://forge.katzen.cafe/katzen-cafe/iowo.git
synced 2024-11-05 15:26:24 +01:00
cleanup: remove unneeded source format in read instruction
The image crate is able to infer the format, so that data is redundant
This commit is contained in:
parent
10886be00a
commit
d79383a7df
|
@ -2,7 +2,7 @@ pub mod read {
|
|||
use image::{io::Reader as ImageReader, DynamicImage};
|
||||
use ir::instruction::read::{Read, SourceType};
|
||||
|
||||
pub fn read(Read { source, .. }: Read) -> DynamicImage {
|
||||
pub fn read(Read { source }: Read) -> DynamicImage {
|
||||
// TODO: actual error handling
|
||||
let img = ImageReader::open(match source {
|
||||
SourceType::File(path) => path,
|
||||
|
|
|
@ -4,16 +4,9 @@ use std::path::PathBuf;
|
|||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
|
||||
pub struct Read {
|
||||
pub source: SourceType,
|
||||
pub format: SourceFormat,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
|
||||
pub enum SourceType {
|
||||
File(PathBuf),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
|
||||
pub enum SourceFormat {
|
||||
Jpeg,
|
||||
Png,
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
instructions: {
|
||||
0: Read((
|
||||
source: File("testfiles/rails.png"),
|
||||
format: Png,
|
||||
)),
|
||||
1: Write((
|
||||
target: File("testfiles/gen/out.jpg"),
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
instructions: {
|
||||
0: Read((
|
||||
source: File("testfiles/rails.png"),
|
||||
format: Png,
|
||||
)),
|
||||
1: Filter(Invert),
|
||||
2: Write((
|
||||
|
|
Loading…
Reference in a new issue