Debian Codegraph @

src/block/lines.rs

raw symbols SCIP
1 //! Extract lines from a block of pixel bytes.
2
3 use craterust-analyzer cargo exr 1.74.0 crate/::mathrust-analyzer cargo exr 1.74.0 math/::*;
4 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::{Cursorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/Cursor#};
5 use craterust-analyzer cargo exr 1.74.0 crate/::errorrust-analyzer cargo exr 1.74.0 error/::{Resultrust-analyzer cargo exr 1.74.0 error/Result#, UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult#};
6 use smallvecrust-analyzer cargo smallvec 1.15.1 crate/::SmallVecrust-analyzer cargo smallvec 1.15.1 SmallVec#;
7 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Rangerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#;
8 use craterust-analyzer cargo exr 1.74.0 crate/::blockrust-analyzer cargo exr 1.74.0 block/::{BlockIndexrust-analyzer cargo exr 1.74.0 block/BlockIndex#};
9 use craterust-analyzer cargo exr 1.74.0 crate/::metarust-analyzer cargo exr 1.74.0 meta/::attributerust-analyzer cargo exr 1.74.0 meta/attribute/::ChannelListrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelList#;
10
11
12 /// A single line of pixels.
13 /// Use [LineRef] or [LineRefMut] for easier type names.
14 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
15 pub struct LineSlicerust-analyzer cargo exr 1.74.0 block/lines/LineSlice#<T> {
16
17 // TODO also store enum SampleType, as it would always be matched in every place it is used
18
19 /// Where this line is located inside the image.
20 pub locationrust-analyzer cargo exr 1.74.0 block/lines/LineSlice#location.: LineIndexrust-analyzer cargo exr 1.74.0 block/lines/LineIndex#,
21
22 /// The raw bytes of the pixel line, either `&[u8]` or `&mut [u8]`.
23 /// Must be re-interpreted as slice of f16, f32, or u32,
24 /// according to the channel data type.
25 pub valuerust-analyzer cargo exr 1.74.0 block/lines/LineSlice#value.: T,
26 }
27
28
29 /// An reference to a single line of pixels.
30 /// May go across the whole image or just a tile section of it.
31 ///
32 /// This line contains an immutable slice that all samples will be read from.
33 pub type LineRefrust-analyzer cargo exr 1.74.0 block/lines/LineRef#<'s> = LineSlicerust-analyzer cargo exr 1.74.0 block/lines/LineSlice#<&'s [u8]>;
34
35 /// A reference to a single mutable line of pixels.
36 /// May go across the whole image or just a tile section of it.
37 ///
38 /// This line contains a mutable slice that all samples will be written to.
39 pub type LineRefMutrust-analyzer cargo exr 1.74.0 block/lines/LineRefMut#<'s> = LineSlicerust-analyzer cargo exr 1.74.0 block/lines/LineSlice#<&'s mut [u8]>;
40
41
42 /// Specifies where a row of pixels lies inside an image.
43 /// This is a globally unique identifier which includes
44 /// the layer, channel index, and pixel location.
45 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:)]
46 pub struct LineIndexrust-analyzer cargo exr 1.74.0 block/lines/LineIndex# {
47
48 /// Index of the layer.
49 pub layerrust-analyzer cargo exr 1.74.0 block/lines/LineIndex#layer.: usize,
50
51 /// The channel index of the layer.
52 pub channelrust-analyzer cargo exr 1.74.0 block/lines/LineIndex#channel.: usize,
53
54 /// Index of the mip or rip level in the image.
55 pub levelrust-analyzer cargo exr 1.74.0 block/lines/LineIndex#level.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<usize>,
56
57 /// Position of the most left pixel of the row.
58 pub positionrust-analyzer cargo exr 1.74.0 block/lines/LineIndex#position.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<usize>,
59
60 /// The width of the line; the number of samples in this row,
61 /// that is, the number of f16, f32, or u32 values.
62 pub sample_countrust-analyzer cargo exr 1.74.0 block/lines/LineIndex#sample_count.: usize,
63 }
64
65
66 impl LineIndexrust-analyzer cargo exr 1.74.0 block/lines/LineIndex# {
67
68 /// Iterates the lines of this block index in interleaved fashion:
69 /// For each line in this block, this iterator steps once through each channel.
70 /// This is how lines are stored in a pixel data block.
71 ///
72 /// Does not check whether `self.layer_index`, `self.level`, `self.size` and `self.position` are valid indices.__
73 // TODO be sure this cannot produce incorrect data, as this is not further checked but only handled with panics
74 #[inline]
75 #[must_use]
76 pub fn lines_in_blockrust-analyzer cargo exr 1.74.0 block/lines/impl#[LineIndex]lines_in_block().(block: BlockIndexrust-analyzer cargo exr 1.74.0 block/BlockIndex#, channels: &ChannelListrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelList#) -> impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#=(Rangerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#<usize>, LineIndexrust-analyzer cargo exr 1.74.0 block/lines/LineIndex#)> {
77 struct LineIterrust-analyzer cargo exr 1.74.0 block/lines/LineIter# {
78 layerrust-analyzer cargo exr 1.74.0 block/lines/LineIter#layer.: usize, levelrust-analyzer cargo exr 1.74.0 block/lines/LineIter#level.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<usize>, widthrust-analyzer cargo exr 1.74.0 block/lines/LineIter#width.: usize,
79 end_yrust-analyzer cargo exr 1.74.0 block/lines/LineIter#end_y.: usize, xrust-analyzer cargo exr 1.74.0 block/lines/LineIter#x.: usize, channel_sizesrust-analyzer cargo exr 1.74.0 block/lines/LineIter#channel_sizes.: SmallVecrust-analyzer cargo smallvec 1.15.1 SmallVec#<[usize; 8]>,
80 byterust-analyzer cargo exr 1.74.0 block/lines/LineIter#byte.: usize, channelrust-analyzer cargo exr 1.74.0 block/lines/LineIter#channel.: usize, yrust-analyzer cargo exr 1.74.0 block/lines/LineIter#y.: usize,
81 }
82
83 // FIXME what about sub sampling??
84
85 impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for LineIterrust-analyzer cargo exr 1.74.0 block/lines/LineIter# {
86 type Itemrust-analyzer cargo exr 1.74.0 block/lines/impl#[LineIter][Iterator]Item# = (Rangerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#<usize>, LineIndexrust-analyzer cargo exr 1.74.0 block/lines/LineIndex#);
87 // TODO size hint?
88
89 fn nextrust-analyzer cargo exr 1.74.0 block/lines/impl#[LineIter][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo exr 1.74.0 block/lines/impl#[LineIter][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> {
90 if self.yrust-analyzer cargo exr 1.74.0 block/lines/LineIter#y. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().self.end_yrust-analyzer cargo exr 1.74.0 block/lines/LineIter#end_y. {
91
92 // compute return value before incrementing
93 let byte_len = self.channel_sizesrust-analyzer cargo exr 1.74.0 block/lines/LineIter#channel_sizes.[rust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`][`Index<I>`]index().self.channelrust-analyzer cargo exr 1.74.0 block/lines/LineIter#channel.]rust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`][`Index<I>`]index().;
94 let return_value = (
95 (self.byterust-analyzer cargo exr 1.74.0 block/lines/LineIter#byte. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range# rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#self.byterust-analyzer cargo exr 1.74.0 block/lines/LineIter#byte. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().byte_len),
96 LineIndexrust-analyzer cargo exr 1.74.0 block/lines/LineIndex# {
97 channelrust-analyzer cargo exr 1.74.0 block/lines/LineIndex#channel.: self.channelrust-analyzer cargo exr 1.74.0 block/lines/LineIter#channel.,
98 layerrust-analyzer cargo exr 1.74.0 block/lines/LineIndex#layer.: self.layerrust-analyzer cargo exr 1.74.0 block/lines/LineIter#layer.,
99 levelrust-analyzer cargo exr 1.74.0 block/lines/LineIndex#level.: self.levelrust-analyzer cargo exr 1.74.0 block/lines/LineIter#level.,
100 positionrust-analyzer cargo exr 1.74.0 block/lines/LineIndex#position.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(self.xrust-analyzer cargo exr 1.74.0 block/lines/LineIter#x., self.yrust-analyzer cargo exr 1.74.0 block/lines/LineIter#y.),
101 sample_countrust-analyzer cargo exr 1.74.0 block/lines/LineIndex#sample_count.: self.widthrust-analyzer cargo exr 1.74.0 block/lines/LineIter#width.,
102 }
103 );
104
105 { // increment indices
106 self.byterust-analyzer cargo exr 1.74.0 block/lines/LineIter#byte. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().byte_len;
107 self.channelrust-analyzer cargo exr 1.74.0 block/lines/LineIter#channel. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1;
108
109 if self.channelrust-analyzer cargo exr 1.74.0 block/lines/LineIter#channel. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().self.channel_sizesrust-analyzer cargo exr 1.74.0 block/lines/LineIter#channel_sizes..lenrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]len().() {
110 self.channelrust-analyzer cargo exr 1.74.0 block/lines/LineIter#channel. = 0;
111 self.yrust-analyzer cargo exr 1.74.0 block/lines/LineIter#y. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1;
112 }
113 }
114
115 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(return_value)
116 }
117
118 else {
119 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
120 }
121 }
122 }
123
124 let channel_line_sizes: SmallVecrust-analyzer cargo smallvec 1.15.1 SmallVec#<[usize; 8]> = channels.listrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelList#list..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
125 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(move |channel| block.pixel_sizerust-analyzer cargo exr 1.74.0 block/BlockIndex#pixel_size..0rust-analyzer cargo exr 1.74.0 math/Vec2#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().channel.sample_typerust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sample_type..bytes_per_samplerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[SampleType]bytes_per_sample().()) // FIXME is it fewer samples per tile or just fewer tiles for sampled images???
126 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
127
128 LineIterrust-analyzer cargo exr 1.74.0 block/lines/LineIter# {
129 layerrust-analyzer cargo exr 1.74.0 block/lines/LineIter#layer.: block.layerrust-analyzer cargo exr 1.74.0 block/BlockIndex#layer.,
130 levelrust-analyzer cargo exr 1.74.0 block/lines/LineIter#level.: block.levelrust-analyzer cargo exr 1.74.0 block/BlockIndex#level.,
131 widthrust-analyzer cargo exr 1.74.0 block/lines/LineIter#width.: block.pixel_sizerust-analyzer cargo exr 1.74.0 block/BlockIndex#pixel_size..0rust-analyzer cargo exr 1.74.0 math/Vec2#0.,
132 xrust-analyzer cargo exr 1.74.0 block/lines/LineIter#x.: block.pixel_positionrust-analyzer cargo exr 1.74.0 block/BlockIndex#pixel_position..0rust-analyzer cargo exr 1.74.0 math/Vec2#0.,
133 end_yrust-analyzer cargo exr 1.74.0 block/lines/LineIter#end_y.: block.pixel_positionrust-analyzer cargo exr 1.74.0 block/BlockIndex#pixel_position..yrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]y().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().block.pixel_sizerust-analyzer cargo exr 1.74.0 block/BlockIndex#pixel_size..heightrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]height().(),
134 channel_sizesrust-analyzer cargo exr 1.74.0 block/lines/LineIter#channel_sizes.: channel_line_sizes,
135
136 byterust-analyzer cargo exr 1.74.0 block/lines/LineIter#byte.: 0,
137 channelrust-analyzer cargo exr 1.74.0 block/lines/LineIter#channel.: 0,
138 yrust-analyzer cargo exr 1.74.0 block/lines/LineIter#y.: block.pixel_positionrust-analyzer cargo exr 1.74.0 block/BlockIndex#pixel_position..yrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]y().()
139 }
140 }
141 }
142
143
144
145 impl<'s> LineRefMutrust-analyzer cargo exr 1.74.0 block/lines/LineRefMut#<'s> {
146
147 /// Writes the samples (f16, f32, u32 values) into this line value reference.
148 /// Use `write_samples` if there is no slice available.
149 #[inline]
150 #[must_use]
151 pub fn write_samples_from_slicerust-analyzer cargo exr 1.74.0 block/lines/impl#[`LineSlice<&'s mut [u8]>`]write_samples_from_slice().<T: craterust-analyzer cargo exr 1.74.0 crate/::iorust-analyzer cargo exr 1.74.0 io/::Datarust-analyzer cargo exr 1.74.0 io/Data#>(self, slice: &[T]) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
152 debug_assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert_eq!!(slice.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().(), self.locationrust-analyzer cargo exr 1.74.0 block/lines/LineSlice#location..sample_countrust-analyzer cargo exr 1.74.0 block/lines/LineIndex#sample_count., "slice size does not match the line width");
153 debug_assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert_eq!!(self.valuerust-analyzer cargo exr 1.74.0 block/lines/LineSlice#value..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().(), self.locationrust-analyzer cargo exr 1.74.0 block/lines/LineSlice#location..sample_countrust-analyzer cargo exr 1.74.0 block/lines/LineIndex#sample_count. *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). T::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE., "sample type size does not match line byte size");
154
155 T::write_slice_nerust-analyzer cargo exr 1.74.0 io/Data#write_slice_ne().(&mut Cursorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/Cursor#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/impl#[`Cursor<T>`]new().(self.valuerust-analyzer cargo exr 1.74.0 block/lines/LineSlice#value.), slice)
156 }
157
158 /// Iterate over all samples in this line, from left to right.
159 /// The supplied `get_line` function returns the sample value
160 /// for a given sample index within the line,
161 /// which starts at zero for each individual line.
162 /// Use `write_samples_from_slice` if you already have a slice of samples.
163 #[inline]
164 #[must_use]
165 pub fn write_samplesrust-analyzer cargo exr 1.74.0 block/lines/impl#[`LineSlice<&'s mut [u8]>`]write_samples().<T: craterust-analyzer cargo exr 1.74.0 crate/::iorust-analyzer cargo exr 1.74.0 io/::Datarust-analyzer cargo exr 1.74.0 io/Data#>(self, mut get_sample: impl FnMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/FnMut#(usize) -> T) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
166 debug_assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert_eq!!(self.valuerust-analyzer cargo exr 1.74.0 block/lines/LineSlice#value..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().(), self.locationrust-analyzer cargo exr 1.74.0 block/lines/LineSlice#location..sample_countrust-analyzer cargo exr 1.74.0 block/lines/LineIndex#sample_count. *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). T::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE., "sample type size does not match line byte size");
167
168 let mut write = Cursorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/Cursor#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/impl#[`Cursor<T>`]new().(self.valuerust-analyzer cargo exr 1.74.0 block/lines/LineSlice#value.);
169
170 for index in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#self.locationrust-analyzer cargo exr 1.74.0 block/lines/LineSlice#location..sample_countrust-analyzer cargo exr 1.74.0 block/lines/LineIndex#sample_count. {
171 T::write_nerust-analyzer cargo exr 1.74.0 io/Data#write_ne().(get_sample(index), &mut write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
172 }
173
174 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
175 }
176 }
177
178 impl LineRefrust-analyzer cargo exr 1.74.0 block/lines/LineRef#<'_> {
179
180 /// Read the samples (f16, f32, u32 values) from this line value reference.
181 /// Use `read_samples` if there is not slice available.
182 pub fn read_samples_into_slicerust-analyzer cargo exr 1.74.0 block/lines/impl#[`LineSlice<&[u8]>`]read_samples_into_slice().<T: craterust-analyzer cargo exr 1.74.0 crate/::iorust-analyzer cargo exr 1.74.0 io/::Datarust-analyzer cargo exr 1.74.0 io/Data#>(self, slice: &mut [T]) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
183 debug_assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert_eq!!(slice.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().(), self.locationrust-analyzer cargo exr 1.74.0 block/lines/LineSlice#location..sample_countrust-analyzer cargo exr 1.74.0 block/lines/LineIndex#sample_count., "slice size does not match the line width");
184 debug_assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert_eq!!(self.valuerust-analyzer cargo exr 1.74.0 block/lines/LineSlice#value..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().(), self.locationrust-analyzer cargo exr 1.74.0 block/lines/LineSlice#location..sample_countrust-analyzer cargo exr 1.74.0 block/lines/LineIndex#sample_count. *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). T::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE., "sample type size does not match line byte size");
185
186 T::read_slice_nerust-analyzer cargo exr 1.74.0 io/Data#read_slice_ne().(&mut Cursorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/Cursor#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/impl#[`Cursor<T>`]new().(self.valuerust-analyzer cargo exr 1.74.0 block/lines/LineSlice#value.), slice)
187 }
188
189 /// Iterate over all samples in this line, from left to right.
190 /// Use `read_sample_into_slice` if you already have a slice of samples.
191 pub fn read_samplesrust-analyzer cargo exr 1.74.0 block/lines/impl#[`LineSlice<&[u8]>`]read_samples().<T: craterust-analyzer cargo exr 1.74.0 crate/::iorust-analyzer cargo exr 1.74.0 io/::Datarust-analyzer cargo exr 1.74.0 io/Data#>(&self) -> impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = Resultrust-analyzer cargo exr 1.74.0 error/Result#<T>> + '_ {
192 debug_assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert_eq!!(self.valuerust-analyzer cargo exr 1.74.0 block/lines/LineSlice#value..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().(), self.locationrust-analyzer cargo exr 1.74.0 block/lines/LineSlice#location..sample_countrust-analyzer cargo exr 1.74.0 block/lines/LineIndex#sample_count. *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). T::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE., "sample type size does not match line byte size");
193
194 let mut read = self.valuerust-analyzer cargo exr 1.74.0 block/lines/LineSlice#value.; // FIXME deep data
195 (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#self.locationrust-analyzer cargo exr 1.74.0 block/lines/LineSlice#location..sample_countrust-analyzer cargo exr 1.74.0 block/lines/LineIndex#sample_count.).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(move |_| T::read_nerust-analyzer cargo exr 1.74.0 io/Data#read_ne().(&mut read))
196 }
197 }