Raw-rs: Remove fortuples dependency (#2082)
Remove fortuples from Raw-rs
This commit is contained in:
parent
4df780391c
commit
b7ba2c3637
|
|
@ -49,7 +49,7 @@ checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.79",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -144,7 +144,7 @@ version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.79",
|
"syn",
|
||||||
"toml",
|
"toml",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -384,17 +384,6 @@ dependencies = [
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "fortuples"
|
|
||||||
version = "0.9.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "87630a8087e9cac4b7edfb6ee5e250ddca9112b57b6b17d8f5107375a3a8eace"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn 1.0.109",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-channel"
|
name = "futures-channel"
|
||||||
version = "0.3.31"
|
version = "0.3.31"
|
||||||
|
|
@ -698,7 +687,7 @@ checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.79",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -934,7 +923,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.79",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -984,7 +973,7 @@ dependencies = [
|
||||||
"proc-macro-crate",
|
"proc-macro-crate",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.79",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -1025,7 +1014,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.79",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -1132,7 +1121,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a65f2e60fbf1063868558d69c6beacf412dc755f9fc020f514b7955fc914fe30"
|
checksum = "a65f2e60fbf1063868558d69c6beacf412dc755f9fc020f514b7955fc914fe30"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.79",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -1244,7 +1233,6 @@ version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitstream-io",
|
"bitstream-io",
|
||||||
"build-camera-data",
|
"build-camera-data",
|
||||||
"fortuples",
|
|
||||||
"image",
|
"image",
|
||||||
"libraw-rs",
|
"libraw-rs",
|
||||||
"num_enum",
|
"num_enum",
|
||||||
|
|
@ -1458,7 +1446,7 @@ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.79",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -1555,17 +1543,6 @@ version = "2.6.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
|
checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "syn"
|
|
||||||
version = "1.0.109"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"unicode-ident",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.79"
|
version = "2.0.79"
|
||||||
|
|
@ -1625,7 +1602,7 @@ name = "tag-derive"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.79",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -1664,7 +1641,7 @@ checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.79",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -1905,7 +1882,7 @@ dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.79",
|
"syn",
|
||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -1939,7 +1916,7 @@ checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.79",
|
"syn",
|
||||||
"wasm-bindgen-backend",
|
"wasm-bindgen-backend",
|
||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared",
|
||||||
]
|
]
|
||||||
|
|
@ -2105,7 +2082,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.79",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ build-camera-data = { path = "build-camera-data" }
|
||||||
# Required dependencies
|
# Required dependencies
|
||||||
bitstream-io = "2.5.3"
|
bitstream-io = "2.5.3"
|
||||||
num_enum = "0.7.3"
|
num_enum = "0.7.3"
|
||||||
fortuples = "0.9.1"
|
|
||||||
thiserror = "1.0.64"
|
thiserror = "1.0.64"
|
||||||
|
|
||||||
# Optional dependencies (should be dev dependencies, but Cargo currently doesn't allow optional dev dependencies)
|
# Optional dependencies (should be dev dependencies, but Cargo currently doesn't allow optional dev dependencies)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
use crate::CHANNELS_IN_RGB;
|
use crate::CHANNELS_IN_RGB;
|
||||||
use fortuples::fortuples;
|
|
||||||
|
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
pub struct RawPixel {
|
pub struct RawPixel {
|
||||||
|
|
@ -25,21 +24,30 @@ impl<T: Fn(RawPixel) -> u16> RawPixelTransform for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fortuples! {
|
macro_rules! impl_raw_pixel_transform {
|
||||||
#[tuples::min_size(1)]
|
($($idx:tt $t:tt),+) => {
|
||||||
#[tuples::max_size(8)]
|
impl<$($t,)+> RawPixelTransform for ($($t,)+)
|
||||||
impl RawPixelTransform for #Tuple
|
|
||||||
where
|
where
|
||||||
#(#Member: RawPixelTransform),*
|
$($t: RawPixelTransform,)+
|
||||||
{
|
{
|
||||||
fn apply(&mut self, mut pixel: RawPixel) -> u16 {
|
fn apply(&mut self, mut pixel: RawPixel) -> u16 {
|
||||||
#(pixel.value = #self.apply(pixel);)*
|
$(pixel.value = self.$idx.apply(pixel);)*
|
||||||
|
|
||||||
pixel.value
|
pixel.value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl_raw_pixel_transform!(0 A);
|
||||||
|
impl_raw_pixel_transform!(0 A, 1 B);
|
||||||
|
impl_raw_pixel_transform!(0 A, 1 B, 2 C);
|
||||||
|
impl_raw_pixel_transform!(0 A, 1 B, 2 C, 3 D);
|
||||||
|
impl_raw_pixel_transform!(0 A, 1 B, 2 C, 3 D, 4 E);
|
||||||
|
impl_raw_pixel_transform!(0 A, 1 B, 2 C, 3 D, 4 E, 5 F);
|
||||||
|
impl_raw_pixel_transform!(0 A, 1 B, 2 C, 3 D, 4 E, 5 F, 6 G);
|
||||||
|
impl_raw_pixel_transform!(0 A, 1 B, 2 C, 3 D, 4 E, 5 F, 6 G, 7 H);
|
||||||
|
|
||||||
pub trait PixelTransform {
|
pub trait PixelTransform {
|
||||||
fn apply(&mut self, pixel: Pixel) -> [u16; CHANNELS_IN_RGB];
|
fn apply(&mut self, pixel: Pixel) -> [u16; CHANNELS_IN_RGB];
|
||||||
}
|
}
|
||||||
|
|
@ -50,17 +58,26 @@ impl<T: Fn(Pixel) -> [u16; CHANNELS_IN_RGB]> PixelTransform for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fortuples! {
|
macro_rules! impl_pixel_transform {
|
||||||
#[tuples::min_size(1)]
|
($($idx:tt $t:tt),+) => {
|
||||||
#[tuples::max_size(8)]
|
impl<$($t,)+> PixelTransform for ($($t,)+)
|
||||||
impl PixelTransform for #Tuple
|
|
||||||
where
|
where
|
||||||
#(#Member: PixelTransform),*
|
$($t: PixelTransform,)+
|
||||||
{
|
{
|
||||||
fn apply(&mut self, mut pixel: Pixel) -> [u16; CHANNELS_IN_RGB] {
|
fn apply(&mut self, mut pixel: Pixel) -> [u16; CHANNELS_IN_RGB] {
|
||||||
#(pixel.values = #self.apply(pixel);)*
|
$(pixel.values = self.$idx.apply(pixel);)*
|
||||||
|
|
||||||
pixel.values
|
pixel.values
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl_pixel_transform!(0 A);
|
||||||
|
impl_pixel_transform!(0 A, 1 B);
|
||||||
|
impl_pixel_transform!(0 A, 1 B, 2 C);
|
||||||
|
impl_pixel_transform!(0 A, 1 B, 2 C, 3 D);
|
||||||
|
impl_pixel_transform!(0 A, 1 B, 2 C, 3 D, 4 E);
|
||||||
|
impl_pixel_transform!(0 A, 1 B, 2 C, 3 D, 4 E, 5 F);
|
||||||
|
impl_pixel_transform!(0 A, 1 B, 2 C, 3 D, 4 E, 5 F, 6 G);
|
||||||
|
impl_pixel_transform!(0 A, 1 B, 2 C, 3 D, 4 E, 5 F, 6 G, 7 H);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue