use core::marker::PhantomData;
use crate::output::{AnimationFrame, OwnedAnimationFrame};
use crate::sink::SinkError;
use crate::{ImageInfo, OutputInfo};
use enough::Stop;
use zenpixels::PixelSlice;
use super::decoder::{AnimationFrameDecoder, StreamingDecode};
pub struct Unsupported<E>(PhantomData<fn() -> E>);
impl<E: core::error::Error + Send + Sync + 'static> StreamingDecode for Unsupported<E> {
type Error = E;
fn next_batch(&mut self) -> Result<Option<(u32, PixelSlice<'_>)>, E> {
unreachable!("Unsupported: streaming decode stub should never be constructed")
}
fn info(&self) -> &ImageInfo {
unreachable!("Unsupported: streaming decode stub should never be constructed")
}
}
impl<E: core::error::Error + Send + Sync + 'static> AnimationFrameDecoder for Unsupported<E> {
type Error = E;
fn wrap_sink_error(_err: SinkError) -> E {
unreachable!("Unsupported: full frame decode stub should never be constructed")
}
fn info(&self) -> &ImageInfo {
unreachable!("Unsupported: full frame decode stub should never be constructed")
}
fn render_next_frame(
&mut self,
_stop: Option<&dyn Stop>,
) -> Result<Option<AnimationFrame<'_>>, E> {
unreachable!("Unsupported: full frame decode stub should never be constructed")
}
fn render_next_frame_owned(
&mut self,
_stop: Option<&dyn Stop>,
) -> Result<Option<OwnedAnimationFrame>, E> {
unreachable!("Unsupported: full frame decode stub should never be constructed")
}
fn render_next_frame_to_sink(
&mut self,
_stop: Option<&dyn Stop>,
_sink: &mut dyn crate::DecodeRowSink,
) -> Result<Option<OutputInfo>, E> {
unreachable!("Unsupported: full frame decode stub should never be constructed")
}
}