1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use rgb::{alt::BGRA8, RGBA8};
use std::convert::Infallible;

pub trait Convert {
	type Out;
	type Err;

	fn convert_frame(&self, from: &[BGRA8], to: &mut [RGBA8]);

	fn add_frame(&mut self, data: &mut [u8]) -> Result<(), Self::Err>;

	fn finish(self) -> Result<Self::Out, Self::Err>;
}

pub enum DummyConvert {}

impl Convert for DummyConvert {
	type Out = ();
	type Err = Infallible;

	fn convert_frame(&self, _: &[BGRA8], _: &mut [RGBA8]) {
		unreachable!()
	}

	fn add_frame(&mut self, _: &mut [u8]) -> Result<(), Self::Err> {
		unreachable!()
	}

	fn finish(self) -> Result<Self::Out, Self::Err> {
		unreachable!()
	}
}