#iter #row #column #imgref #col


A small crate for iterating over the rows or columns of imgref buffers

8 unstable releases (3 breaking)

0.4.0 Aug 13, 2022
0.3.3 Jul 6, 2022
0.3.1 Jun 22, 2022
0.2.0 Jun 18, 2022
0.1.2 Jun 18, 2022

#631 in Rust patterns

Download history 28/week @ 2022-11-28 22/week @ 2022-12-05 27/week @ 2022-12-12 20/week @ 2022-12-19 17/week @ 2022-12-26 17/week @ 2023-01-02 21/week @ 2023-01-09 17/week @ 2023-01-16 41/week @ 2023-01-23 50/week @ 2023-01-30 48/week @ 2023-02-06 77/week @ 2023-02-13 39/week @ 2023-02-20 63/week @ 2023-02-27 28/week @ 2023-03-06 22/week @ 2023-03-13

157 downloads per month
Used in stackblur-iter

MIT license



A small crate for iterating over the rows or columns of imgref buffers.

This crate exports four traits that allow creating iterators over rows or columns of imgref::Imgs:

  • ImgIterPtr for Img<*const [T]>; allows creating iterators over *const pointers

  • ImgIterPtrMut for Img<*mut [T]>; allows creating iterators over *mut pointers

  • ImgIter for Img<&[T]>; allows creating iterators over shared references

  • ImgIterMut for Img<&mut [T]>; allows creating iterators over mutable references

As well as two utility traits for converting to Img<*const [T]> or Img<*mut [T]>:

  • ImgAsPtr for conversions to Img<*const [T]>.

  • ImgAsMutPtr for conversions to Img<*mut [T]>.

    This is actually not implemented by anything other than Img<*mut [T]>, but it exists for the purpose of documenting why it cannot be implemented for Img<&mut [T]>.

Additionally, when the (experimental!) simd feature is enabled, there are four more traits - ImgSimdIter, ImgSimdIterMut, ImgSimdIterPtr, and ImgSimdIterPtrMut. These allow creating iterators over multiple rows or columns of an image at once. They don't actually depend on SIMD or a nightly compiler - they just return multiple items at once.

Methods on ImgIterPtr and ImgIterPtrMut are unsafe because they offset on the provided pointers. ImgIter and ImgIterMut cannot include safe versions because the pointer iterators may outlive the references.

See the documentation for more information.