Module embedded_graphics::iterator::raw

source ·
Expand description

Raw data iterator.

Raw data iterators are used to implement rendering of custom image formats. Most users won’t need to use these types directly and should instead use ImageRaw.

The RawDataSlice is used to specify the raw data format for a byte slice. This slice can than be converted into an optimized iterator for that data format by using into_iter().

§Examples

use embedded_graphics::{iterator::raw::RawDataSlice, pixelcolor::raw::{RawU16, BigEndian}};

let data = [0xAA, 0xBB, 0x12, 0x34];

// The data type and byte order needs to be specified explicitly to set the data format.
let slice = RawDataSlice::<RawU16, BigEndian>::new(&data);

let mut iter = slice.into_iter();
assert_eq!(iter.next(), Some(RawU16::new(0xAABB)));
assert_eq!(iter.next(), Some(RawU16::new(0x1234)));
assert_eq!(iter.next(), None);

Structs§