pub struct MockImageCodecs(/* private fields */);Expand description
Image codecs that answer what the test set, at once, and keep what the app asked of them, with hardware codecs where the test gives them. Every clone is the same codecs.
Implementations§
Source§impl MockImageCodecs
impl MockImageCodecs
Sourcepub fn new(answers: ImageAnswers) -> MockImageCodecs
pub fn new(answers: ImageAnswers) -> MockImageCodecs
Codecs that answer answers, with no hardware codecs.
Sourcepub fn with_hardware(answers: ImageAnswers) -> MockImageCodecs
pub fn with_hardware(answers: ImageAnswers) -> MockImageCodecs
Codecs that answer answers, with hardware codecs whose buffers are
MockHardwareBuffers.
Sourcepub fn set_answers(&self, answers: ImageAnswers)
pub fn set_answers(&self, answers: ImageAnswers)
Each call answers answers from now on.
Trait Implementations§
Source§impl Clone for MockImageCodecs
impl Clone for MockImageCodecs
Source§impl ImageCodecs for MockImageCodecs
impl ImageCodecs for MockImageCodecs
Source§fn decoded_formats(&self) -> Vec<String>
fn decoded_formats(&self) -> Vec<String>
The formats it decodes, by MIME type, such as
image/jpeg.Source§fn encoded_formats(&self) -> Vec<String>
fn encoded_formats(&self) -> Vec<String>
The formats it encodes, by MIME type.
Source§fn open(&self, data: Arc<[u8]>) -> ImageFuture<Box<dyn ImageSource>>
fn open(&self, data: Arc<[u8]>) -> ImageFuture<Box<dyn ImageSource>>
The image
data encodes, read as far as its size, pictures, orientation and metadata:
ImageErrorKind::Unsupported for bytes of no format it decodes,
ImageErrorKind::Damaged for bytes it cannot read that far.Source§fn open_file(&self, path: &Path) -> ImageFuture<Box<dyn ImageSource>>
fn open_file(&self, path: &Path) -> ImageFuture<Box<dyn ImageSource>>
The image in the file at
path, which the system reads only as far as it needs, as a
photo’s metadata or the small picture it carries: ImageErrorKind::NotFound for a path
with no file.Source§fn encode_pixels(
&self,
pixels: PixelBuffer,
format: &str,
quality: Option<f32>,
) -> ImageFuture<Vec<u8>>
fn encode_pixels( &self, pixels: PixelBuffer, format: &str, quality: Option<f32>, ) -> ImageFuture<Vec<u8>>
pixels encoded in format, one of the encoded_formats, at
quality from 0.0, the smallest, to 1.0, the best, where the format loses detail, or
the system’s own where None: ImageErrorKind::Unsupported for a format it does not
encode.Source§fn hardware_image_codecs(&self) -> Option<&dyn HardwareImageCodecs>
fn hardware_image_codecs(&self) -> Option<&dyn HardwareImageCodecs>
The system’s hardware codecs, or
None where it neither decodes into hardware buffers
nor encodes from them.Auto Trait Implementations§
impl !RefUnwindSafe for MockImageCodecs
impl !Send for MockImageCodecs
impl !Sync for MockImageCodecs
impl !UnwindSafe for MockImageCodecs
impl Forget for MockImageCodecs
impl Freeze for MockImageCodecs
impl Move for MockImageCodecs
impl Unpin for MockImageCodecs
impl UnsafeUnpin for MockImageCodecswhere
*const RcInner<CodecsShared> is !null: UnsafeUnpin,
PhantomData<RcInner<CodecsShared>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more