pub trait Filter {
type Frame;
// Required methods
fn try_push(&mut self, frame: Self::Frame) -> Result<(), CodecError>;
fn try_flush(&mut self) -> Result<(), CodecError>;
fn take(&mut self) -> Result<Option<Self::Frame>, Error>;
// Provided methods
fn push(&mut self, frame: Self::Frame) -> Result<(), Error> { ... }
fn flush(&mut self) -> Result<(), Error> { ... }
}Expand description
A media filter.
§Common filter operation
- Push a frame to the filter.
- Take all frames from the filter until you get
None. - If there are more frames to be filtered, continue with 1.
- Flush the filter.
- Take all frames from the filter until you get
None.
Required Associated Types§
Required Methods§
Sourcefn try_push(&mut self, frame: Self::Frame) -> Result<(), CodecError>
fn try_push(&mut self, frame: Self::Frame) -> Result<(), CodecError>
Push a given frame to the filter.
Sourcefn try_flush(&mut self) -> Result<(), CodecError>
fn try_flush(&mut self) -> Result<(), CodecError>
Flush the filter.