forked from katzen-cafe/iowo
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
4 changed files with 1 additions and 10 deletions
|
@ -2,7 +2,7 @@ pub mod read {
|
||||||
use image::{io::Reader as ImageReader, DynamicImage};
|
use image::{io::Reader as ImageReader, DynamicImage};
|
||||||
use ir::instruction::read::{Read, SourceType};
|
use ir::instruction::read::{Read, SourceType};
|
||||||
|
|
||||||
pub fn read(Read { source, .. }: Read) -> DynamicImage {
|
pub fn read(Read { source }: Read) -> DynamicImage {
|
||||||
// TODO: actual error handling
|
// TODO: actual error handling
|
||||||
let img = ImageReader::open(match source {
|
let img = ImageReader::open(match source {
|
||||||
SourceType::File(path) => path,
|
SourceType::File(path) => path,
|
||||||
|
|
|
@ -4,16 +4,9 @@ use std::path::PathBuf;
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
|
||||||
pub struct Read {
|
pub struct Read {
|
||||||
pub source: SourceType,
|
pub source: SourceType,
|
||||||
pub format: SourceFormat,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
|
||||||
pub enum SourceType {
|
pub enum SourceType {
|
||||||
File(PathBuf),
|
File(PathBuf),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
|
|
||||||
pub enum SourceFormat {
|
|
||||||
Jpeg,
|
|
||||||
Png,
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
instructions: {
|
instructions: {
|
||||||
0: Read((
|
0: Read((
|
||||||
source: File("testfiles/rails.png"),
|
source: File("testfiles/rails.png"),
|
||||||
format: Png,
|
|
||||||
)),
|
)),
|
||||||
1: Write((
|
1: Write((
|
||||||
target: File("testfiles/gen/out.jpg"),
|
target: File("testfiles/gen/out.jpg"),
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
instructions: {
|
instructions: {
|
||||||
0: Read((
|
0: Read((
|
||||||
source: File("testfiles/rails.png"),
|
source: File("testfiles/rails.png"),
|
||||||
format: Png,
|
|
||||||
)),
|
)),
|
||||||
1: Filter(Invert),
|
1: Filter(Invert),
|
||||||
2: Write((
|
2: Write((
|
||||||
|
|
Loading…
Reference in a new issue