Trait Detect

Source
pub trait Detect<IO> {
    type DetOut;
    type IOOut;

    // Required method
    fn detect(
        &self,
        io: IO,
    ) -> impl Future<Output = Result<(Self::DetOut, Self::IOOut)>>;
}
Expand description

Detect is a trait for detecting a certain pattern in the input stream.

It accepts an input stream and returns a tuple of the detected pattern and the wrapped input stream which is usually a PrefixedReadIo. The implementation can choose to whether add the prefix data. If it fails to detect the pattern, it should represent the error inside the DetOut.

Required Associated Types§

Required Methods§

Source

fn detect( &self, io: IO, ) -> impl Future<Output = Result<(Self::DetOut, Self::IOOut)>>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<IO> Detect<IO> for PrefixDetector
where IO: AsyncReadRent,

Source§

impl<const N: usize, F, IO, DetOut> Detect<IO> for FixedLengthDetector<N, F>
where F: Fn(&mut [u8]) -> DetOut, IO: AsyncReadRent,