Skip to main content

MockImageCodecs

Struct MockImageCodecs 

Source
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

Source

pub fn new(answers: ImageAnswers) -> MockImageCodecs

Codecs that answer answers, with no hardware codecs.

Source

pub fn with_hardware(answers: ImageAnswers) -> MockImageCodecs

Codecs that answer answers, with hardware codecs whose buffers are MockHardwareBuffers.

Source

pub fn set_answers(&self, answers: ImageAnswers)

Each call answers answers from now on.

Source

pub fn asked(&self) -> Vec<CodecCall>

What the app asked, in order.

Trait Implementations§

Source§

impl Clone for MockImageCodecs

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ImageCodecs for MockImageCodecs

Source§

fn decoded_formats(&self) -> Vec<String>

The formats it decodes, by MIME type, such as image/jpeg.
Source§

fn encoded_formats(&self) -> Vec<String>

The formats it encodes, by MIME type.
Source§

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>>

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>>

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>

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
where *const RcInner<CodecsShared> is !null: Freeze, PhantomData<RcInner<CodecsShared>>: Freeze,

§

impl Move for MockImageCodecs

§

impl Unpin for MockImageCodecs
where Rc<CodecsShared>: Unpin,

§

impl UnsafeUnpin for MockImageCodecs
where *const RcInner<CodecsShared> is !null: UnsafeUnpin, PhantomData<RcInner<CodecsShared>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>