pub trait FormatDecoder:
Sized
+ Clone
+ Send
+ Sync {
type Output: Pixel<Subpixel = u8>;
const FORMATS: &'static [FrameFormat];
// Required methods
fn write_output(
fcc: FrameFormat,
resolution: Resolution,
data: &[u8],
) -> Result<Vec<u8>, NokhwaError>;
fn write_output_buffer(
fcc: FrameFormat,
resolution: Resolution,
data: &[u8],
dest: &mut [u8],
) -> Result<(), NokhwaError>;
}Expand description
Trait that has methods to convert raw data from the webcam to a proper raw image.
Required Associated Constants§
const FORMATS: &'static [FrameFormat]
Required Associated Types§
Required Methods§
Sourcefn write_output(
fcc: FrameFormat,
resolution: Resolution,
data: &[u8],
) -> Result<Vec<u8>, NokhwaError>
fn write_output( fcc: FrameFormat, resolution: Resolution, data: &[u8], ) -> Result<Vec<u8>, NokhwaError>
Allocates and returns a Vec
§Errors
If the data is malformed, or the source FrameFormat is incompatible, this will error.
Sourcefn write_output_buffer(
fcc: FrameFormat,
resolution: Resolution,
data: &[u8],
dest: &mut [u8],
) -> Result<(), NokhwaError>
fn write_output_buffer( fcc: FrameFormat, resolution: Resolution, data: &[u8], dest: &mut [u8], ) -> Result<(), NokhwaError>
Writes to a user provided buffer.
§Errors
If the data is malformed, the source FrameFormat is incompatible, or the user-alloted buffer is not large enough, this will error.
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.