Skip to main content

CodecEntry

Trait CodecEntry 

Source
pub trait CodecEntry: Codec + Sealed {
    // Required methods
    fn inspect(
        &self,
        reader: &mut dyn ReadSeek,
        options: &InspectOptions,
    ) -> Result<ContainerSummary, CodecError>;
    fn decode(
        &self,
        reader: &mut dyn ReadSeek,
        options: &DecodeOptions,
    ) -> Result<DecodeResult, CodecError>;
}
Expand description

Public inspection and decoding entry points.

use cadmpeg_ir::codec::{
    Codec, CodecEntry, CodecError, Confidence, ContainerSummary, DecodeOptions,
    DecodeResult, ReadSeek,
};
use cadmpeg_ir::decode::{DecodeContext, View};
use cadmpeg_ir::decode::InspectOptions;

struct Rogue;
impl Codec for Rogue {
    fn id(&self) -> &'static str { "rogue" }
    fn detect(&self, _: &[u8]) -> Confidence { Confidence::No }
    fn inspect_impl(&self, _: &DecodeContext<'_>, _: View<'_>)
        -> Result<ContainerSummary, CodecError> { unimplemented!() }
    fn decode_impl(&self, _: &DecodeContext<'_>, _: View<'_>)
        -> Result<DecodeResult, CodecError> { unimplemented!() }
}
impl CodecEntry for Rogue {
    fn inspect(&self, _: &mut dyn ReadSeek, _: &InspectOptions)
        -> Result<ContainerSummary, CodecError> { unimplemented!() }
    fn decode(&self, _: &mut dyn ReadSeek, _: &DecodeOptions)
        -> Result<DecodeResult, CodecError> { unimplemented!() }
}

Required Methods§

Source

fn inspect( &self, reader: &mut dyn ReadSeek, options: &InspectOptions, ) -> Result<ContainerSummary, CodecError>

Inspects the source under its input and resource limits.

Source

fn decode( &self, reader: &mut dyn ReadSeek, options: &DecodeOptions, ) -> Result<DecodeResult, CodecError>

Decodes the source under its input and resource limits.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<C: Codec + ?Sized> CodecEntry for C