Skip to main content

ImagesMut

Struct ImagesMut 

Source
pub struct ImagesMut<'w> { /* private fields */ }
Expand description

A mutable view over the images (frames) held by a MagickWand.

Obtained from MagickWand::images_mut. Because ImageMagick exposes a single internal iterator, only one ImageMut may be borrowed at a time; this is enforced by the borrow checker, as each accessor borrows the view mutably.

Implementations§

Source§

impl<'w> ImagesMut<'w>

Source

pub fn count(&self) -> usize

The number of images (frames) in the list.

Source

pub fn is_empty(&self) -> bool

Returns true if the list contains no images.

Source

pub fn get(&mut self, index: usize) -> Option<ImageMut<'_>>

Mutably borrow the frame at index, or None if out of bounds.

Source

pub fn first(&mut self) -> Option<ImageMut<'_>>

Mutably borrow the first frame, or None if the list is empty.

Source

pub fn last(&mut self) -> Option<ImageMut<'_>>

Mutably borrow the last frame, or None if the list is empty.

Source

pub fn remove(&mut self, index: usize) -> Result<(), MagickError>

Remove the frame at index from the list.

Note that removing a frame shifts the indices of all later frames down by one, so any indices computed before the removal are stale afterwards.

Source

pub fn append(&mut self, other: &MagickWand) -> Result<(), MagickError>

Append all frames from other to the end of this list.

Source

pub fn for_each(&mut self, f: impl FnMut(usize, ImageMut<'_>))

Visit every frame in order, passing its index and a mutable borrow to f.

f must not add or remove frames (e.g. via ImageMut’s deref to MagickWand::remove_image / MagickWand::add_image): the set of indices to visit is fixed when iteration begins, so changing the frame count mid-iteration visits the wrong frames. Use ImagesMut::remove or ImagesMut::append before or after iterating instead.

Source

pub fn try_for_each( &mut self, f: impl FnMut(usize, ImageMut<'_>) -> Result<(), MagickError>, ) -> Result<(), MagickError>

Like ImagesMut::for_each, but f may fail; the first error stops iteration and is returned. The same “do not add or remove frames” caveat as ImagesMut::for_each applies.

Auto Trait Implementations§

§

impl<'w> Freeze for ImagesMut<'w>

§

impl<'w> RefUnwindSafe for ImagesMut<'w>

§

impl<'w> Send for ImagesMut<'w>

§

impl<'w> !Sync for ImagesMut<'w>

§

impl<'w> Unpin for ImagesMut<'w>

§

impl<'w> UnsafeUnpin for ImagesMut<'w>

§

impl<'w> !UnwindSafe for ImagesMut<'w>

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<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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.