Debian Codegraph @

src/meta/attribute.rs

raw symbols SCIP
1
2 //! Contains all meta data attributes.
3 //! Each layer can have any number of [`Attribute`]s, including custom attributes.
4
5 use smallvecrust-analyzer cargo smallvec 1.15.1 crate/::SmallVecrust-analyzer cargo smallvec 1.15.1 SmallVec#;
6
7
8 /// Contains one of all possible attributes.
9 /// Includes a variant for custom attributes.
10 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
11 pub enum AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue# {
12
13 /// Channel meta data.
14 ChannelListrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#ChannelList#(ChannelListrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelList#),
15
16 /// Color space definition.
17 Chromaticitiesrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Chromaticities#(Chromaticitiesrust-analyzer cargo exr 1.74.0 meta/attribute/Chromaticities#),
18
19 /// Compression method of this layer.
20 Compressionrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Compression#(Compressionrust-analyzer cargo exr 1.74.0 compression/Compression#),
21
22 /// This image is an environment map.
23 EnvironmentMaprust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#EnvironmentMap#(EnvironmentMaprust-analyzer cargo exr 1.74.0 meta/attribute/EnvironmentMap#),
24
25 /// Film roll information.
26 KeyCoderust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#KeyCode#(KeyCoderust-analyzer cargo exr 1.74.0 meta/attribute/KeyCode#),
27
28 /// Order of the bocks in the file.
29 LineOrderrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#LineOrder#(LineOrderrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#),
30
31 /// A 3x3 matrix of floats.
32 Matrix3x3rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Matrix3x3#(Matrix3x3rust-analyzer cargo exr 1.74.0 meta/attribute/Matrix3x3#),
33
34 /// A 4x4 matrix of floats.
35 Matrix4x4rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Matrix4x4#(Matrix4x4rust-analyzer cargo exr 1.74.0 meta/attribute/Matrix4x4#),
36
37 /// 8-bit rgba Preview of the image.
38 Previewrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Preview#(Previewrust-analyzer cargo exr 1.74.0 meta/attribute/Preview#),
39
40 /// An integer dividend and divisor.
41 Rationalrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Rational#(Rationalrust-analyzer cargo exr 1.74.0 meta/attribute/Rational#),
42
43 /// Deep or flat and tiled or scan line.
44 BlockTyperust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#BlockType#(BlockTyperust-analyzer cargo exr 1.74.0 meta/attribute/BlockType#),
45
46 /// List of texts.
47 TextVectorrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#TextVector#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#>),
48
49 /// How to tile up the image.
50 TileDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#TileDescription#(TileDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription#),
51
52 /// Timepoint and more.
53 TimeCoderust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#TimeCode#(TimeCoderust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#),
54
55 /// A string of byte-chars.
56 Textrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Text#(Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#),
57
58 /// 64-bit float
59 F64rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#F64#(f64),
60
61 /// 32-bit float
62 F32rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#F32#(f32),
63
64 /// 32-bit signed integer
65 I32rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#I32#(i32),
66
67 /// 2D integer rectangle.
68 IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#IntegerBounds#(IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#),
69
70 /// 2D float rectangle.
71 FloatRectrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#FloatRect#(FloatRectrust-analyzer cargo exr 1.74.0 meta/attribute/FloatRect#),
72
73 /// 2D integer vector.
74 IntVec2rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#IntVec2#(Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<i32>),
75
76 /// 2D float vector.
77 FloatVec2rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#FloatVec2#(Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<f32>),
78
79 /// 3D integer vector.
80 IntVec3rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#IntVec3#((i32, i32, i32)),
81
82 /// 3D float vector.
83 FloatVec3rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#FloatVec3#((f32, f32, f32)),
84
85 /// An explicitly untyped attribute for binary application data.
86 /// Also contains the type name of this value.
87 /// The format of the byte contents is explicitly unspecified.
88 /// Used for custom application data.
89 Bytesrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Bytes# {
90
91 /// An application-specific type hint of the byte contents.
92 type_hintrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Bytes#type_hint.: Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#,
93
94 /// The contents of this byte array are completely unspecified
95 /// and should be treated as untrusted data.
96 bytesrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Bytes#bytes.: SmallVecrust-analyzer cargo smallvec 1.15.1 SmallVec#<[u8; 16]>
97 },
98
99 /// A custom attribute.
100 /// Contains the type name of this value.
101 Customrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Custom# {
102
103 /// The name of the type this attribute is an instance of.
104 kindrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Custom#kind.: Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#,
105
106 /// The value, stored in little-endian byte order, of the value.
107 /// Use the `exr::io::Data` trait to extract binary values from this vector.
108 bytesrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Custom#bytes.: SmallVecrust-analyzer cargo smallvec 1.15.1 SmallVec#<[u8; 16]>
109 },
110 }
111
112 /// A byte array with each byte being a char.
113 /// This is not UTF and it must be constructed from a standard string.
114 // TODO is this ascii? use a rust ascii crate?
115 #[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:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord:, PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] // hash implemented manually
116 pub struct Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text# {
117 bytesrust-analyzer cargo exr 1.74.0 meta/attribute/Text#bytes.: TextBytesrust-analyzer cargo exr 1.74.0 meta/attribute/TextBytes#,
118 }
119
120 /// Contains time information for this frame within a sequence.
121 /// Also defined methods to compile this information into a
122 /// `TV60`, `TV50` or `Film24` bit sequence, packed into `u32`.
123 ///
124 /// Satisfies the [SMPTE standard 12M-1999](https://en.wikipedia.org/wiki/SMPTE_timecode).
125 /// For more in-depth information, see [philrees.co.uk/timecode](http://www.philrees.co.uk/articles/timecode.htm).
126 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, 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:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)]
127 pub struct TimeCoderust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode# {
128
129 /// Hours 0 - 23 are valid.
130 pub hoursrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#hours.: u8,
131
132 /// Minutes 0 - 59 are valid.
133 pub minutesrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#minutes.: u8,
134
135 /// Seconds 0 - 59 are valid.
136 pub secondsrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#seconds.: u8,
137
138 /// Frame Indices 0 - 29 are valid.
139 pub framerust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#frame.: u8,
140
141 /// Whether this is a drop frame.
142 pub drop_framerust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#drop_frame.: bool,
143
144 /// Whether this is a color frame.
145 pub color_framerust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#color_frame.: bool,
146
147 /// Field Phase.
148 pub field_phaserust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#field_phase.: bool,
149
150 /// Flags for `TimeCode.binary_groups`.
151 pub binary_group_flagsrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#binary_group_flags.: [bool; 3],
152
153 /// The user-defined control codes.
154 /// Every entry in this array can use at most 3 bits.
155 /// This results in a maximum value of 15, including 0, for each `u8`.
156 pub binary_groupsrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#binary_groups.: [u8; 8]
157 }
158
159 /// layer type, specifies block type and deepness.
160 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, 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:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:)]
161 pub enum BlockTyperust-analyzer cargo exr 1.74.0 meta/attribute/BlockType# {
162
163 /// Corresponds to the string value `scanlineimage`.
164 ScanLinerust-analyzer cargo exr 1.74.0 meta/attribute/BlockType#ScanLine#,
165
166 /// Corresponds to the string value `tiledimage`.
167 Tilerust-analyzer cargo exr 1.74.0 meta/attribute/BlockType#Tile#,
168
169 /// Corresponds to the string value `deepscanline`.
170 DeepScanLinerust-analyzer cargo exr 1.74.0 meta/attribute/BlockType#DeepScanLine#,
171
172 /// Corresponds to the string value `deeptile`.
173 DeepTilerust-analyzer cargo exr 1.74.0 meta/attribute/BlockType#DeepTile#,
174 }
175
176 /// The string literals used to represent a `BlockType` in a file.
177 pub mod block_type_stringsrust-analyzer cargo exr 1.74.0 meta/attribute/block_type_strings/ {
178
179 /// Type attribute text value of flat scan lines
180 pub const SCAN_LINErust-analyzer cargo exr 1.74.0 meta/attribute/block_type_strings/SCAN_LINE.: &'static [u8] = b"scanlineimage";
181
182 /// Type attribute text value of flat tiles
183 pub const TILErust-analyzer cargo exr 1.74.0 meta/attribute/block_type_strings/TILE.: &'static [u8] = b"tiledimage";
184
185 /// Type attribute text value of deep scan lines
186 pub const DEEP_SCAN_LINErust-analyzer cargo exr 1.74.0 meta/attribute/block_type_strings/DEEP_SCAN_LINE.: &'static [u8] = b"deepscanline";
187
188 /// Type attribute text value of deep tiles
189 pub const DEEP_TILErust-analyzer cargo exr 1.74.0 meta/attribute/block_type_strings/DEEP_TILE.: &'static [u8] = b"deeptile";
190 }
191
192
193 pub use craterust-analyzer cargo exr 1.74.0 crate/::compressionrust-analyzer cargo exr 1.74.0 compression/::Compressionrust-analyzer cargo exr 1.74.0 compression/Compression#;
194
195 /// The integer rectangle describing where an layer is placed on the infinite 2D global space.
196 pub type DataWindowrust-analyzer cargo exr 1.74.0 meta/attribute/DataWindow# = IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#;
197
198 /// The integer rectangle limiting which part of the infinite 2D global space should be displayed.
199 pub type DisplayWindowrust-analyzer cargo exr 1.74.0 meta/attribute/DisplayWindow# = IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#;
200
201 /// An integer dividend and divisor, together forming a ratio.
202 pub type Rationalrust-analyzer cargo exr 1.74.0 meta/attribute/Rational# = (i32, u32);
203
204 /// A float matrix with four rows and four columns.
205 pub type Matrix4x4rust-analyzer cargo exr 1.74.0 meta/attribute/Matrix4x4# = [f32; 4*4];
206
207 /// A float matrix with three rows and three columns.
208 pub type Matrix3x3rust-analyzer cargo exr 1.74.0 meta/attribute/Matrix3x3# = [f32; 3*3];
209
210 /// A rectangular section anywhere in 2D integer space.
211 /// Valid from minimum coordinate (including) `-1,073,741,822`
212 /// to maximum coordinate (including) `1,073,741,822`, the value of (`i32::MAX/2 -1`).
213 #[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:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, 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:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:)]
214 pub struct IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds# {
215
216 /// The top left corner of this rectangle.
217 /// The `Box2I32` includes this pixel if the size is not zero.
218 pub positionrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#position.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<i32>,
219
220 /// How many pixels to include in this `Box2I32`.
221 /// Extends to the right and downwards.
222 /// Does not include the actual boundary, just like `Vec::len()`.
223 pub sizerust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#size.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<usize>,
224 }
225
226 /// A rectangular section anywhere in 2D float space.
227 #[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:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
228 pub struct FloatRectrust-analyzer cargo exr 1.74.0 meta/attribute/FloatRect# {
229
230 /// The top left corner location of the rectangle (inclusive)
231 pub minrust-analyzer cargo exr 1.74.0 meta/attribute/FloatRect#min.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<f32>,
232
233 /// The bottom right corner location of the rectangle (inclusive)
234 pub maxrust-analyzer cargo exr 1.74.0 meta/attribute/FloatRect#max.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<f32>
235 }
236
237 /// A List of channels. Channels must be sorted alphabetically.
238 #[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:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, 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:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:)]
239 pub struct ChannelListrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelList# {
240
241 /// The channels in this list.
242 pub listrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelList#list.: SmallVecrust-analyzer cargo smallvec 1.15.1 SmallVec#<[ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#; 5]>,
243
244 /// The number of bytes that one pixel in this image needs.
245 // FIXME this needs to account for subsampling anywhere?
246 pub bytes_per_pixelrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelList#bytes_per_pixel.: usize, // FIXME only makes sense for flat images!
247
248 /// The sample type of all channels, if all channels have the same type.
249 pub uniform_sample_typerust-analyzer cargo exr 1.74.0 meta/attribute/ChannelList#uniform_sample_type.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<SampleTyperust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#>,
250 }
251
252 /// A single channel in an layer.
253 /// Does not contain the actual pixel data,
254 /// but instead merely describes it.
255 #[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:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, 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:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:)]
256 pub struct ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription# {
257
258 /// One of "R", "G", or "B" most of the time.
259 pub namerust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#name.: Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#,
260
261 /// U32, F16 or F32.
262 pub sample_typerust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sample_type.: SampleTyperust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#,
263
264 /// This attribute only tells lossy compression methods
265 /// whether this value should be quantized exponentially or linearly.
266 ///
267 /// Should be `false` for red, green, or blue channels.
268 /// Should be `true` for hue, chroma, saturation, or alpha channels.
269 pub quantize_linearlyrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#quantize_linearly.: bool,
270
271 /// How many of the samples are skipped compared to the other channels in this layer.
272 ///
273 /// Can be used for chroma subsampling for manual lossy data compression.
274 /// Values other than 1 are allowed only in flat, scan-line based images.
275 /// If an image is deep or tiled, x and y sampling rates for all of its channels must be 1.
276 pub samplingrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sampling.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<usize>,
277 }
278
279 /// The type of samples in this channel.
280 #[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:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, 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:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:)]
281 pub enum SampleTyperust-analyzer cargo exr 1.74.0 meta/attribute/SampleType# {
282
283 /// This channel contains 32-bit unsigned int values.
284 U32rust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#U32#,
285
286 /// This channel contains 16-bit float values.
287 F16rust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#F16#,
288
289 /// This channel contains 32-bit float values.
290 F32rust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#F32#,
291 }
292
293 /// The color space of the pixels.
294 ///
295 /// If a file doesn't have a chromaticities attribute, display software
296 /// should assume that the file's primaries and the white point match `Rec. ITU-R BT.709-3`.
297 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, 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:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
298 pub struct Chromaticitiesrust-analyzer cargo exr 1.74.0 meta/attribute/Chromaticities# {
299
300 /// "Red" location on the CIE XY chromaticity diagram.
301 pub redrust-analyzer cargo exr 1.74.0 meta/attribute/Chromaticities#red.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<f32>,
302
303 /// "Green" location on the CIE XY chromaticity diagram.
304 pub greenrust-analyzer cargo exr 1.74.0 meta/attribute/Chromaticities#green.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<f32>,
305
306 /// "Blue" location on the CIE XY chromaticity diagram.
307 pub bluerust-analyzer cargo exr 1.74.0 meta/attribute/Chromaticities#blue.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<f32>,
308
309 /// "White" location on the CIE XY chromaticity diagram.
310 pub whiterust-analyzer cargo exr 1.74.0 meta/attribute/Chromaticities#white.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<f32>
311 }
312
313 /// If this attribute is present, it describes
314 /// how this texture should be projected onto an environment.
315 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, 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:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:)]
316 pub enum EnvironmentMaprust-analyzer cargo exr 1.74.0 meta/attribute/EnvironmentMap# {
317
318 /// This image is an environment map projected like a world map.
319 LatitudeLongituderust-analyzer cargo exr 1.74.0 meta/attribute/EnvironmentMap#LatitudeLongitude#,
320
321 /// This image contains the six sides of a cube.
322 Cuberust-analyzer cargo exr 1.74.0 meta/attribute/EnvironmentMap#Cube#,
323 }
324
325 /// Uniquely identifies a motion picture film frame.
326 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, 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:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:)]
327 pub struct KeyCoderust-analyzer cargo exr 1.74.0 meta/attribute/KeyCode# {
328
329 /// Identifies a film manufacturer.
330 pub film_manufacturer_coderust-analyzer cargo exr 1.74.0 meta/attribute/KeyCode#film_manufacturer_code.: i32,
331
332 /// Identifies a film type.
333 pub film_typerust-analyzer cargo exr 1.74.0 meta/attribute/KeyCode#film_type.: i32,
334
335 /// Specifies the film roll prefix.
336 pub film_roll_prefixrust-analyzer cargo exr 1.74.0 meta/attribute/KeyCode#film_roll_prefix.: i32,
337
338 /// Specifies the film count.
339 pub countrust-analyzer cargo exr 1.74.0 meta/attribute/KeyCode#count.: i32,
340
341 /// Specifies the perforation offset.
342 pub perforation_offsetrust-analyzer cargo exr 1.74.0 meta/attribute/KeyCode#perforation_offset.: i32,
343
344 /// Specifies the perforation count of each single frame.
345 pub perforations_per_framerust-analyzer cargo exr 1.74.0 meta/attribute/KeyCode#perforations_per_frame.: i32,
346
347 /// Specifies the perforation count of each single film.
348 pub perforations_per_countrust-analyzer cargo exr 1.74.0 meta/attribute/KeyCode#perforations_per_count.: i32,
349 }
350
351 /// In what order the `Block`s of pixel data appear in a file.
352 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, 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:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:)]
353 pub enum LineOrderrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder# {
354
355 /// The blocks in the file are ordered in descending rows from left to right.
356 /// When compressing in parallel, this option requires potentially large amounts of memory.
357 /// In that case, use `LineOrder::Unspecified` for best performance.
358 Increasingrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#Increasing#,
359
360 /// The blocks in the file are ordered in ascending rows from right to left.
361 /// When compressing in parallel, this option requires potentially large amounts of memory.
362 /// In that case, use `LineOrder::Unspecified` for best performance.
363 Decreasingrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#Decreasing#,
364
365 /// The blocks are not ordered in a specific way inside the file.
366 /// In multi-core file writing, this option offers the best performance.
367 Unspecifiedrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#Unspecified#,
368 }
369
370 /// A small `rgba` image of `i8` values that approximates the real exr image.
371 // TODO is this linear?
372 #[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:, 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:)]
373 pub struct Previewrust-analyzer cargo exr 1.74.0 meta/attribute/Preview# {
374
375 /// The dimensions of the preview image.
376 pub sizerust-analyzer cargo exr 1.74.0 meta/attribute/Preview#size.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<usize>,
377
378 /// An array with a length of 4 × width × height.
379 /// The pixels are stored in `LineOrder::Increasing`.
380 /// Each pixel consists of the four `u8` values red, green, blue, alpha.
381 pub pixel_datarust-analyzer cargo exr 1.74.0 meta/attribute/Preview#pixel_data.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<i8>,
382 }
383
384 /// Describes how the layer is divided into tiles.
385 /// Specifies the size of each tile in the image
386 /// and whether this image contains multiple resolution levels.
387 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, 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:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:)]
388 pub struct TileDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription# {
389
390 /// The size of each tile.
391 /// Stays the same number of pixels across all levels.
392 pub tile_sizerust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription#tile_size.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<usize>,
393
394 /// Whether to also store smaller versions of the image.
395 pub level_moderust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription#level_mode.: LevelModerust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#,
396
397 /// Whether to round up or down when calculating Mip/Rip levels.
398 pub rounding_moderust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription#rounding_mode.: RoundingModerust-analyzer cargo exr 1.74.0 math/RoundingMode#,
399 }
400
401 /// Whether to also store increasingly smaller versions of the original image.
402 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, 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:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:)]
403 pub enum LevelModerust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode# {
404
405 /// Only a single level.
406 Singularrust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#Singular#,
407
408 /// Levels with a similar aspect ratio.
409 MipMaprust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#MipMap#,
410
411 /// Levels with all possible aspect ratios.
412 RipMaprust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#RipMap#,
413 }
414
415
416 /// The raw bytes that make up a string in an exr file.
417 /// Each `u8` is a single char.
418 // will mostly be "R", "G", "B" or "deepscanlineimage"
419 pub type TextBytesrust-analyzer cargo exr 1.74.0 meta/attribute/TextBytes# = SmallVecrust-analyzer cargo smallvec 1.15.1 SmallVec#<[u8; 24]>;
420
421 /// A byte slice, interpreted as text
422 pub type TextSlicerust-analyzer cargo exr 1.74.0 meta/attribute/TextSlice# = [u8];
423
424
425 use craterust-analyzer cargo exr 1.74.0 crate/::iorust-analyzer cargo exr 1.74.0 io/::*;
426 use craterust-analyzer cargo exr 1.74.0 crate/::metarust-analyzer cargo exr 1.74.0 meta/::{sequence_endrust-analyzer cargo exr 1.74.0 meta/sequence_end/};
427 use craterust-analyzer cargo exr 1.74.0 crate/::errorrust-analyzer cargo exr 1.74.0 error/::*;
428 use craterust-analyzer cargo exr 1.74.0 crate/::mathrust-analyzer cargo exr 1.74.0 math/::{RoundingModerust-analyzer cargo exr 1.74.0 math/RoundingMode#, Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#};
429 use halfrust-analyzer cargo half 2.6.0 crate/::f16rust-analyzer cargo half 2.6.0 binary16/f16#;
430 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::convertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/::{TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#};
431 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::borrowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/::Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#;
432 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::hashrust-analyzer cargo std https://github.com/rust-lang/rust/library/std hash/::{Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash#, Hasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hasher#};
433 use bit_fieldrust-analyzer cargo bit_field 0.10.3 crate/::BitFieldrust-analyzer cargo bit_field 0.10.3 BitField#;
434
435
436 fn invalid_typerust-analyzer cargo exr 1.74.0 meta/attribute/invalid_type().() -> Errorrust-analyzer cargo exr 1.74.0 error/Error# {
437 Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("attribute type mismatch")
438 }
439
440
441 impl Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text# {
442
443 /// Create a `Text` from an `str` reference.
444 /// Returns `None` if this string contains unsupported chars.
445 pub fn new_or_nonerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]new_or_none().(string: impl AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<str>) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]> {
446 let vec : Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<TextBytesrust-analyzer cargo exr 1.74.0 meta/attribute/TextBytes#> = string.as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().().charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().()
447 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|character| u8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u8][`TryFrom<u64>`]try_from().(character as u64).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().())
448 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
449
450 vec.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]::from_bytes_uncheckedrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]from_bytes_unchecked().)
451 }
452
453 /// Create a `Text` from an `str` reference.
454 /// Panics if this string contains unsupported chars.
455 pub fn new_or_panicrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]new_or_panic().(string: impl AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<str>) -> Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text] {
456 Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]::new_or_nonerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]new_or_none().(string).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("exr::Text contains unsupported characters")
457 }
458
459 /// Create a `Text` from a slice of bytes,
460 /// without checking any of the bytes.
461 pub fn from_slice_uncheckedrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]from_slice_unchecked().(text: &TextSlicerust-analyzer cargo exr 1.74.0 meta/attribute/TextSlice#) -> Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text] {
462 Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]::from_bytes_uncheckedrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]from_bytes_unchecked().(SmallVecrust-analyzer cargo smallvec 1.15.1 SmallVec#::from_slicerust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]from_slice().(text))
463 }
464
465 /// Create a `Text` from the specified bytes object,
466 /// without checking any of the bytes.
467 pub fn from_bytes_uncheckedrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]from_bytes_unchecked().(bytes: TextBytesrust-analyzer cargo exr 1.74.0 meta/attribute/TextBytes#) -> Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text] {
468 Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text# { bytesrust-analyzer cargo exr 1.74.0 meta/attribute/Text#bytes. }
469 }
470
471 /// The internal ASCII bytes this text is made of.
472 pub fn as_slicerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]as_slice().(&self) -> &TextSlicerust-analyzer cargo exr 1.74.0 meta/attribute/TextSlice# {
473 self.bytesrust-analyzer cargo exr 1.74.0 meta/attribute/Text#bytes..as_slicerust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]as_slice().()
474 }
475
476 /// Check whether this string is valid, adjusting `long_names` if required.
477 /// If `long_names` is not provided, text length will be entirely unchecked.
478 pub fn validaterust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]validate().(&self, null_terminated: bool, long_names: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&mut bool>) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
479 Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]::validate_bytesrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]validate_bytes().(self.as_slicerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]as_slice().(), null_terminated, long_names)
480 }
481
482 /// Check whether some bytes are valid, adjusting `long_names` if required.
483 /// If `long_names` is not provided, text length will be entirely unchecked.
484 pub fn validate_bytesrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]validate_bytes().(text: &TextSlicerust-analyzer cargo exr 1.74.0 meta/attribute/TextSlice#, null_terminated: bool, long_names: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&mut bool>) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
485 if null_terminated && text.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() {
486 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("text must not be empty"));
487 }
488
489 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(long) = long_names {
490 if text.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().256 { return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("text must not be longer than 255")); }
491 if text.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().32 { *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().long = true; }
492 }
493
494 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
495 }
496
497 /// The byte count this string would occupy if it were encoded as a null-terminated string.
498 pub fn null_terminated_byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]null_terminated_byte_size().(&self) -> usize {
499 self.bytesrust-analyzer cargo exr 1.74.0 meta/attribute/Text#bytes..lenrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]len().() 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().sequence_endrust-analyzer cargo exr 1.74.0 meta/sequence_end/::byte_sizerust-analyzer cargo exr 1.74.0 meta/sequence_end/byte_size().()
500 }
501
502 /// The byte count this string would occupy if it were encoded as a size-prefixed string.
503 pub fn i32_sized_byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]i32_sized_byte_size().(&self) -> usize {
504 self.bytesrust-analyzer cargo exr 1.74.0 meta/attribute/Text#bytes..lenrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]len().() 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().i32::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE.
505 }
506
507 /// The byte count this string would occupy if it were encoded as a size-prefixed string.
508 pub fn u32_sized_byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]u32_sized_byte_size().(&self) -> usize {
509 self.bytesrust-analyzer cargo exr 1.74.0 meta/attribute/Text#bytes..lenrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]len().() 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().u32::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE.
510 }
511
512 /// Write the length of a string and then the contents with that length.
513 pub fn write_i32_sized_lerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]write_i32_sized_le().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, write: &mut W) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
514 debug_assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert!!(self.validaterust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]validate().( false, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#).is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().(), "text size bug");
515 i32::write_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]write_le().(usize_to_i32rust-analyzer cargo exr 1.74.0 error/usize_to_i32().(self.bytesrust-analyzer cargo exr 1.74.0 meta/attribute/Text#bytes..lenrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]len().(), "text length")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
516 Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]::write_unsized_bytesrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]write_unsized_bytes().(self.bytesrust-analyzer cargo exr 1.74.0 meta/attribute/Text#bytes..as_slicerust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]as_slice().(), write)
517 }
518
519 /// Write the length of a string and then the contents with that length.
520 pub fn write_u32_sized_lerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]write_u32_sized_le().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, write: &mut W) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
521 debug_assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert!!(self.validaterust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]validate().( false, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#).is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().(), "text size bug");
522 u32::write_lerust-analyzer cargo exr 1.74.0 io/impl#[u32][Data]write_le().(usize_to_u32rust-analyzer cargo exr 1.74.0 error/usize_to_u32().(self.bytesrust-analyzer cargo exr 1.74.0 meta/attribute/Text#bytes..lenrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]len().(), "text length")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
523 Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]::write_unsized_bytesrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]write_unsized_bytes().(self.bytesrust-analyzer cargo exr 1.74.0 meta/attribute/Text#bytes..as_slicerust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]as_slice().(), write)
524 }
525
526 /// Without validation, write this instance to the byte stream.
527 fn write_unsized_bytesrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]write_unsized_bytes().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(bytes: &[u8], write: &mut W) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
528 u8::write_slice_lerust-analyzer cargo exr 1.74.0 io/impl#[u8][Data]write_slice_le().(write, bytes)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
529 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
530 }
531
532 /// Read the length of a string and then the contents with that length.
533 pub fn read_i32_sized_lerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]read_i32_sized_le().<R: Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#>(read: &mut R, max_size: usize) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]> {
534 let size = i32_to_usizerust-analyzer cargo exr 1.74.0 error/i32_to_usize().(i32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., "vector size")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
535 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::from_bytes_uncheckedrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]from_bytes_unchecked().(SmallVecrust-analyzer cargo smallvec 1.15.1 SmallVec#::from_vecrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]from_vec().(u8::read_vec_lerust-analyzer cargo exr 1.74.0 io/Data#read_vec_le().(read, size, 1024, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(max_size), "text attribute length")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)))
536 }
537
538 /// Read the length of a string and then the contents with that length.
539 pub fn read_u32_sized_lerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]read_u32_sized_le().<R: Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#>(read: &mut R, max_size: usize) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]> {
540 let size = u32_to_usizerust-analyzer cargo exr 1.74.0 error/u32_to_usize().(u32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[u32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., "text length")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
541 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::from_bytes_uncheckedrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]from_bytes_unchecked().(SmallVecrust-analyzer cargo smallvec 1.15.1 SmallVec#::from_vecrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]from_vec().(u8::read_vec_lerust-analyzer cargo exr 1.74.0 io/Data#read_vec_le().(read, size, 1024, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(max_size), "text attribute length")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)))
542 }
543
544 /// Read the contents with that length.
545 pub fn read_sizedrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]read_sized().<R: Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#>(read: &mut R, size: usize) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]> {
546 const SMALL_SIZErust-analyzer cargo exr 1.74.0 meta/attribute/SMALL_SIZE.: usize = 24;
547
548 // for small strings, read into small vec without heap allocation
549 if size rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().SMALL_SIZErust-analyzer cargo exr 1.74.0 meta/attribute/SMALL_SIZE. {
550 let mut buffer = [0_u8; SMALL_SIZErust-analyzer cargo exr 1.74.0 meta/attribute/SMALL_SIZE.];
551 let data = &mut buffer[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#size]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().;
552
553 read.read_exactrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#read_exact().(data)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
554 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::from_bytes_uncheckedrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]from_bytes_unchecked().(SmallVecrust-analyzer cargo smallvec 1.15.1 SmallVec#::from_slicerust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]from_slice().(data)))
555 }
556
557 // for large strings, read a dynamic vec of arbitrary size
558 else {
559 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::from_bytes_uncheckedrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]from_bytes_unchecked().(SmallVecrust-analyzer cargo smallvec 1.15.1 SmallVec#::from_vecrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]from_vec().(u8::read_vec_lerust-analyzer cargo exr 1.74.0 io/Data#read_vec_le().(read, size, 1024, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, "text attribute length")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)))
560 }
561 }
562
563 /// Write the string contents and a null-terminator.
564 pub fn write_null_terminatedrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]write_null_terminated().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, write: &mut W) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
565 Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]::write_null_terminated_bytesrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]write_null_terminated_bytes().(self.as_slicerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]as_slice().(), write)
566 }
567
568 /// Write the string contents and a null-terminator.
569 fn write_null_terminated_bytesrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]write_null_terminated_bytes().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(bytes: &[u8], write: &mut W) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
570 debug_assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().bytes.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().(), "text is empty bug"); // required to avoid mixup with "sequece_end"
571
572 Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::write_unsized_bytesrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]write_unsized_bytes().(bytes, write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
573 sequence_endrust-analyzer cargo exr 1.74.0 meta/sequence_end/::writerust-analyzer cargo exr 1.74.0 meta/sequence_end/write().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
574 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
575 }
576
577 /// Read a string until the null-terminator is found. Then skips the null-terminator.
578 pub fn read_null_terminatedrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]read_null_terminated().<R: Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#>(read: &mut R, max_len: usize) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]> {
579 let mut bytes = smallvecrust-analyzer cargo smallvec 1.15.1 smallvec!![ u8::read_lerust-analyzer cargo exr 1.74.0 io/impl#[u8][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). ]; // null-terminated strings are always at least 1 byte
580
581 loop {
582 match u8::read_lerust-analyzer cargo exr 1.74.0 io/impl#[u8][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
583 0 => break,
584 non_terminator => bytes.pushrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]push().(non_terminator),
585 }
586
587 if bytes.lenrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().max_len {
588 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("text too long"))
589 }
590 }
591
592 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text# { bytesrust-analyzer cargo exr 1.74.0 meta/attribute/Text#bytes. })
593 }
594
595 /// Allows any text length since it is only used for attribute values,
596 /// but not attribute names, attribute type names, or channel names.
597 fn read_vec_of_i32_sized_texts_lerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]read_vec_of_i32_sized_texts_le().(
598 read: &mut PeekReadrust-analyzer cargo exr 1.74.0 io/PeekRead#<impl Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#>,
599 total_byte_size: usize
600 ) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#>>
601 {
602 let mut result = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(2);
603
604 // length of the text-vector can be inferred from attribute size
605 let mut processed_bytes = 0;
606
607 while processed_bytes 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().total_byte_size {
608 let text = Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::read_i32_sized_lerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]read_i32_sized_le().(read, total_byte_size)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
609 processed_bytes 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().::stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<i32>(); // size i32 of the text
610 processed_bytes 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().text.bytesrust-analyzer cargo exr 1.74.0 meta/attribute/Text#bytes..lenrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]len().();
611 result.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(text);
612 }
613
614 // the expected byte size did not match the actual text byte size
615 if processed_bytes rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().total_byte_size {
616 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("text array byte size"))
617 }
618
619 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(result)
620 }
621
622 /// Allows any text length since it is only used for attribute values,
623 /// but not attribute names, attribute type names, or channel names.
624 fn write_vec_of_i32_sized_texts_lerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]write_vec_of_i32_sized_texts_le().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(write: &mut W, texts: &[Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#]) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
625 // length of the text-vector can be inferred from attribute size
626 for text in texts {
627 text.write_i32_sized_lerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]write_i32_sized_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
628 }
629
630 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
631 }
632
633 /// The underlying bytes that represent this text.
634 pub fn bytesrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]bytes().(&self) -> &[u8] {
635 self.bytesrust-analyzer cargo exr 1.74.0 meta/attribute/Text#bytes..as_slicerust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]as_slice().()
636 }
637
638 /// Iterate over the individual chars in this text, similar to `String::chars()`.
639 /// Does not do any heap-allocation but borrows from this instance instead.
640 pub fn charsrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]chars().(&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# = char> {
641 self.bytesrust-analyzer cargo exr 1.74.0 meta/attribute/Text#bytes..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|&byte| byte as char)
642 }
643
644 /// Compare this `exr::Text` with a plain `&str`.
645 pub fn eqrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]eq().(&self, string: &str) -> bool {
646 string.charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().().eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#eq().(self.charsrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]chars().())
647 }
648
649 /// Compare this `exr::Text` with a plain `&str` ignoring capitalization.
650 pub fn eq_case_insensitiverust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]eq_case_insensitive().(&self, string: &str) -> bool {
651 // this is technically not working for a "turkish i", but those cannot be encoded in exr files anyways
652 let self_chars = self.charsrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]chars().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|char| char.to_ascii_lowercaserust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]to_ascii_lowercase().());
653 let string_chars = string.charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().().flat_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#flat_map().(|ch| ch.to_lowercaserust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]to_lowercase().());
654
655 string_chars.eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#eq().(self_chars)
656 }
657 }
658
659 impl PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#<str> for Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text# {
660 fn eqrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`PartialEq<str>`]eq().(&self, other: &str) -> bool {
661 self.eqrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]eq().(other)
662 }
663 }
664
665 impl PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#<Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#> for str {
666 fn eqrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[str][`PartialEq<Text>`]eq().(&self, other: &Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#) -> bool {
667 other.eqrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]eq().(self)
668 }
669 }
670
671 impl Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq# for Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text# {}
672
673 impl Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<TextSlicerust-analyzer cargo exr 1.74.0 meta/attribute/TextSlice#> for Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text# {
674 fn borrowrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`Borrow<[u8]>`]borrow().(&self) -> &TextSlicerust-analyzer cargo exr 1.74.0 meta/attribute/TextSlice# {
675 self.as_slicerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]as_slice().()
676 }
677 }
678
679 // forwarding implementation. guarantees `text.borrow().hash() == text.hash()` (required for Borrow)
680 impl Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash# for Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text# {
681 fn hashrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][Hash]hash().<H: Hasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hasher#>(&self, state: &mut H) {
682 self.bytesrust-analyzer cargo exr 1.74.0 meta/attribute/Text#bytes..hashrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`][Hash]hash().(state)
683 }
684 }
685
686 impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> for Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text# {
687 fn intorust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`Into<String>`]into().(self) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
688 self.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()
689 }
690 }
691
692 impl<'s> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<&'s str> for Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text# {
693
694 /// Panics if the string contains an unsupported character
695 fn fromrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`From<&'s str>`]from().(str: &'s str) -> Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`From<&'s str>`] {
696 Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`From<&'s str>`]::new_or_panicrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]new_or_panic().(str)
697 }
698 }
699
700
701 /* TODO (currently conflicts with From<&str>)
702 impl<'s> TryFrom<&'s str> for Text {
703 type Error = String;
704
705 fn try_from(value: &'s str) -> std::result::Result<Self, Self::Error> {
706 Text::new_or_none(value)
707 .ok_or_else(|| format!(
708 "exr::Text does not support all characters in the string `{}`",
709 value
710 ))
711 }
712 }*/
713
714
715 impl ::stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text# {
716 fn fmtrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][Debug]fmt().(&self, f: &mut ::stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> ::stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
717 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "exr::Text(\"{}\")", self)
718 }
719 }
720
721 // automatically implements to_string for us
722 impl ::stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text# {
723 fn fmtrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][Display]fmt().(&self, f: &mut ::stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> ::stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
724 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#;
725
726 for &byte in self.bytesrust-analyzer cargo exr 1.74.0 meta/attribute/Text#bytes..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() {
727 f.write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'_>`][Write]write_char().(byte as char)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
728 }
729
730 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
731 }
732 }
733
734
735 impl ChannelListrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelList# {
736
737 /// Does not validate channel order.
738 pub fn newrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelList]new().(channels: SmallVecrust-analyzer cargo smallvec 1.15.1 SmallVec#<[ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#; 5]>) -> Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelList] {
739 let uniform_sample_type = {
740 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(first) = channels.firstrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]first().() {
741 let has_uniform_types = channels.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().skiprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#skip().(1)
742 .allrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#all().(|chan| chan.sample_typerust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sample_type. rust-analyzer cargo exr 1.74.0 meta/attribute/impl#[SampleType][`PartialEq<Self>`]eq().==rust-analyzer cargo exr 1.74.0 meta/attribute/impl#[SampleType][`PartialEq<Self>`]eq(). rust-analyzer cargo exr 1.74.0 meta/attribute/impl#[SampleType][`PartialEq<Self>`]eq().first.sample_typerust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sample_type.);
743
744 if has_uniform_types { Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(first.sample_typerust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sample_type.) } else { Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# }
745 }
746 else { Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# }
747 };
748
749 ChannelListrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelList# {
750 bytes_per_pixelrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelList#bytes_per_pixel.: channels.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|channel| 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().()).sumrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#sum().(),
751 listrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelList#list.: channels, uniform_sample_typerust-analyzer cargo exr 1.74.0 meta/attribute/ChannelList#uniform_sample_type.,
752 }
753 }
754
755 /// Iterate over the channels, and adds to each channel the byte offset of the channels sample type.
756 /// Assumes the internal channel list is properly sorted.
757 pub fn channels_with_byte_offsetrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelList]channels_with_byte_offset().(&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#=(usize, &ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#)> {
758 self.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().().scanrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#scan().(0, |byte_position, channel|{
759 let previous_position = *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().byte_position;
760 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().byte_position 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().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().();
761 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((previous_position, channel))
762 })
763 }
764
765 /// Return the index of the channel with the exact name, case sensitive, or none.
766 /// Potentially uses less than linear time.
767 pub fn find_index_of_channelrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelList]find_index_of_channel().(&self, exact_name: &Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize> {
768 self.listrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelList#list..binary_search_by_keyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]binary_search_by_key().(&exact_name.bytesrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]bytes().(), |chan| chan.namerust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#name..bytesrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]bytes().()).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()
769 }
770
771 // TODO use this in compression methods
772 /*pub fn pixel_section_indices(&self, bounds: IntegerBounds) -> impl '_ + Iterator<Item=(&Channel, usize, usize)> {
773 (bounds.position.y() .. bounds.end().y()).flat_map(|y| {
774 self.list
775 .filter(|channel| mod_p(y, usize_to_i32(channel.sampling.1)) == 0)
776 .flat_map(|channel|{
777 (bounds.position.x() .. bounds.end().x())
778 .filter(|x| mod_p(*x, usize_to_i32(channel.sampling.0)) == 0)
779 .map(|x| (channel, x, y))
780 })
781 })
782 }*/
783 }
784
785 impl BlockTyperust-analyzer cargo exr 1.74.0 meta/attribute/BlockType# {
786
787 /// The corresponding attribute type name literal
788 const TYPE_NAMErust-analyzer cargo exr 1.74.0 meta/attribute/impl#[BlockType]TYPE_NAME.: &'static [u8] = type_namesrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::TEXTrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/TEXT.;
789
790 /// Return a `BlockType` object from the specified attribute text value.
791 pub fn parserust-analyzer cargo exr 1.74.0 meta/attribute/impl#[BlockType]parse().(text: Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[BlockType]> {
792 match text.as_slicerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]as_slice().() {
793 block_type_stringsrust-analyzer cargo exr 1.74.0 meta/attribute/block_type_strings/::SCAN_LINErust-analyzer cargo exr 1.74.0 meta/attribute/block_type_strings/SCAN_LINE. => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(BlockTyperust-analyzer cargo exr 1.74.0 meta/attribute/BlockType#::ScanLinerust-analyzer cargo exr 1.74.0 meta/attribute/BlockType#ScanLine#),
794 block_type_stringsrust-analyzer cargo exr 1.74.0 meta/attribute/block_type_strings/::TILErust-analyzer cargo exr 1.74.0 meta/attribute/block_type_strings/TILE. => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(BlockTyperust-analyzer cargo exr 1.74.0 meta/attribute/BlockType#::Tilerust-analyzer cargo exr 1.74.0 meta/attribute/BlockType#Tile#),
795
796 block_type_stringsrust-analyzer cargo exr 1.74.0 meta/attribute/block_type_strings/::DEEP_SCAN_LINErust-analyzer cargo exr 1.74.0 meta/attribute/block_type_strings/DEEP_SCAN_LINE. => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(BlockTyperust-analyzer cargo exr 1.74.0 meta/attribute/BlockType#::DeepScanLinerust-analyzer cargo exr 1.74.0 meta/attribute/BlockType#DeepScanLine#),
797 block_type_stringsrust-analyzer cargo exr 1.74.0 meta/attribute/block_type_strings/::DEEP_TILErust-analyzer cargo exr 1.74.0 meta/attribute/block_type_strings/DEEP_TILE. => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(BlockTyperust-analyzer cargo exr 1.74.0 meta/attribute/BlockType#::DeepTilerust-analyzer cargo exr 1.74.0 meta/attribute/BlockType#DeepTile#),
798
799 _ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("block type attribute value")),
800 }
801 }
802
803 /// Without validation, write this instance to the byte stream.
804 pub fn writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[BlockType]write().(&self, write: &mut impl Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
805 u8::write_slice_lerust-analyzer cargo exr 1.74.0 io/impl#[u8][Data]write_slice_le().(write, self.to_text_bytesrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[BlockType]to_text_bytes().())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
806 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
807 }
808
809 /// Returns the raw attribute text value this type is represented by in a file.
810 pub fn to_text_bytesrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[BlockType]to_text_bytes().(&self) -> &[u8] {
811 match self {
812 BlockTyperust-analyzer cargo exr 1.74.0 meta/attribute/BlockType#::ScanLinerust-analyzer cargo exr 1.74.0 meta/attribute/BlockType#ScanLine# => block_type_stringsrust-analyzer cargo exr 1.74.0 meta/attribute/block_type_strings/::SCAN_LINErust-analyzer cargo exr 1.74.0 meta/attribute/block_type_strings/SCAN_LINE.,
813 BlockTyperust-analyzer cargo exr 1.74.0 meta/attribute/BlockType#::Tilerust-analyzer cargo exr 1.74.0 meta/attribute/BlockType#Tile# => block_type_stringsrust-analyzer cargo exr 1.74.0 meta/attribute/block_type_strings/::TILErust-analyzer cargo exr 1.74.0 meta/attribute/block_type_strings/TILE.,
814 BlockTyperust-analyzer cargo exr 1.74.0 meta/attribute/BlockType#::DeepScanLinerust-analyzer cargo exr 1.74.0 meta/attribute/BlockType#DeepScanLine# => block_type_stringsrust-analyzer cargo exr 1.74.0 meta/attribute/block_type_strings/::DEEP_SCAN_LINErust-analyzer cargo exr 1.74.0 meta/attribute/block_type_strings/DEEP_SCAN_LINE.,
815 BlockTyperust-analyzer cargo exr 1.74.0 meta/attribute/BlockType#::DeepTilerust-analyzer cargo exr 1.74.0 meta/attribute/BlockType#DeepTile# => block_type_stringsrust-analyzer cargo exr 1.74.0 meta/attribute/block_type_strings/::DEEP_TILErust-analyzer cargo exr 1.74.0 meta/attribute/block_type_strings/DEEP_TILE.,
816 }
817 }
818
819 /// Number of bytes this would consume in an exr file.
820 pub fn byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[BlockType]byte_size().(&self) -> usize {
821 self.to_text_bytesrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[BlockType]to_text_bytes().().lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()
822 }
823 }
824
825
826 impl IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds# {
827
828 /// Create a box with no size located at (0,0).
829 pub fn zerorust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]zero().() -> Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds] {
830 Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]::from_dimensionsrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]from_dimensions().(Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(0, 0))
831 }
832
833 /// Create a box with a size starting at zero.
834 pub fn from_dimensionsrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]from_dimensions().(size: impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<usize>>) -> Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds] {
835 Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]::newrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]new().(Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(0,0), size)
836 }
837
838 /// Create a box with a size and an origin point.
839 pub fn newrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]new().(start: impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<i32>>, size: impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<usize>>) -> Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds] {
840 Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds] { positionrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#position.: start.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().(), sizerust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#size.: size.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().() }
841 }
842
843 /// Returns the top-right coordinate of the rectangle.
844 /// The row and column described by this vector are not included in the rectangle,
845 /// just like `Vec::len()`.
846 pub fn endrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]end().(self) -> Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<i32> {
847 self.positionrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#position. rust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`][`Add<Self>`]add().+rust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`][`Add<Self>`]add(). rust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`][`Add<Self>`]add().self.sizerust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#size..to_i32rust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<usize>`]to_i32().() // larger than max int32 is panic
848 }
849
850 /// Returns the maximum coordinate that a value in this rectangle may have.
851 pub fn maxrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]max().(self) -> Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<i32> {
852 self.endrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]end().() rust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`][`Sub<Self>`]sub().-rust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`][`Sub<Self>`]sub(). rust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`][`Sub<Self>`]sub().Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(1,1)
853 }
854
855 /// Validate this instance.
856 pub fn validaterust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]validate().(&self, max_size: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<usize>>) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
857 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(max_size) = max_size {
858 if self.sizerust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#size..widthrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]width().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().max_size.widthrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]width().() || self.sizerust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#size..heightrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]height().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().max_size.heightrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]height().() {
859 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("window attribute dimension value"));
860 }
861 }
862
863 let min_i64 = Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(self.positionrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#position..xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().() as i64, self.positionrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#position..yrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]y().() as i64);
864
865 let max_i64 = Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(
866 self.positionrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#position..xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().() as i64 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][`Add<Self>`]add().self.sizerust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#size..widthrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]width().() as i64,
867 self.positionrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#position..yrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]y().() as i64 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][`Add<Self>`]add().self.sizerust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#size..heightrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]height().() as i64,
868 );
869
870 Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]::validate_min_max_u64rust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]validate_min_max_u64().(min_i64, max_i64)
871 }
872
873 fn validate_min_max_u64rust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]validate_min_max_u64().(min: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<i64>, max: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<i64>) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
874 let max_box_size_as_i64 = (i32::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]MAX. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Div<Self>`]div().2) as i64; // as defined in the original c++ library
875
876 if max.xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]ge().max_box_size_as_i64
877 || max.yrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]y().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]ge().max_box_size_as_i64
878 || min.xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]le().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][Neg]neg().max_box_size_as_i64
879 || min.yrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]y().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]le().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][Neg]neg().max_box_size_as_i64
880 {
881 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("window size exceeding integer maximum"));
882 }
883
884 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
885 }
886
887 /// Number of bytes this would consume in an exr file.
888 pub fn byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]byte_size().() -> usize {
889 4 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().i32::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE.
890 }
891
892 /// Without validation, write this instance to the byte stream.
893 pub fn writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, write: &mut W) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
894 let Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(x_min, y_min) = self.positionrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#position.;
895 let Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(x_max, y_max) = self.maxrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]max().();
896
897 x_min.write_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
898 y_min.write_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
899 x_max.write_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
900 y_max.write_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
901 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
902 }
903
904 /// Read the value without validating.
905 pub fn readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]read().<R: Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#>(read: &mut R) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]> {
906 let x_min = i32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
907 let y_min = i32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
908 let x_max = i32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
909 let y_max = i32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
910
911 let min = Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(x_min.minrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#min().(x_max), y_min.minrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#min().(y_max));
912 let max = Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(x_min.maxrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#max().(x_max), y_min.maxrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#max().(y_max));
913
914 // prevent addition overflow
915 Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]::validate_min_max_u64rust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]validate_min_max_u64().(
916 Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(min.xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().() as i64, min.yrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]y().() as i64),
917 Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(max.xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().() as i64, max.yrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]y().() as i64),
918 )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
919
920 // add one to max because the max inclusive, but the size is not
921 let size = Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(max.xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().min.xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().(), max.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#[i32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().min.yrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]y().());
922 let size = size.to_usizerust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<i32>`]to_usize().("box coordinates")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
923
924 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds# { positionrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#position.: min, sizerust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#size. })
925 }
926
927 /// Create a new rectangle which is offset by the specified origin.
928 pub fn with_originrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]with_origin().(self, origin: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<i32>) -> Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds] { // TODO rename to "move" or "translate"?
929 IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds# { positionrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#position.: self.positionrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#position. rust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`][`Add<Self>`]add().+rust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`][`Add<Self>`]add(). rust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`][`Add<Self>`]add().origin, .. self }
930 }
931
932 /// Returns whether the specified rectangle is equal to or inside this rectangle.
933 pub fn containsrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]contains().(self, subset: Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]) -> bool {
934 subset.positionrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#position..xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]ge().self.positionrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#position..xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().()
935 && subset.positionrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#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 cmp/impls/impl#[i32][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]ge().self.positionrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#position..yrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]y().()
936 && subset.endrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]end().().xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]le().self.endrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]end().().xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().()
937 && subset.endrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]end().().yrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]y().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]le().self.endrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]end().().yrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]y().()
938 }
939 }
940
941
942 impl FloatRectrust-analyzer cargo exr 1.74.0 meta/attribute/FloatRect# {
943
944 /// Number of bytes this would consume in an exr file.
945 pub fn byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[FloatRect]byte_size().() -> usize {
946 4 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().f32::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE.
947 }
948
949 /// Without validation, write this instance to the byte stream.
950 pub fn writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[FloatRect]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, write: &mut W) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
951 self.minrust-analyzer cargo exr 1.74.0 meta/attribute/FloatRect#min..xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().().write_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
952 self.minrust-analyzer cargo exr 1.74.0 meta/attribute/FloatRect#min..yrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]y().().write_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
953 self.maxrust-analyzer cargo exr 1.74.0 meta/attribute/FloatRect#max..xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().().write_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
954 self.maxrust-analyzer cargo exr 1.74.0 meta/attribute/FloatRect#max..yrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]y().().write_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
955 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
956 }
957
958 /// Read the value without validating.
959 pub fn readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[FloatRect]read().<R: Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#>(read: &mut R) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[FloatRect]> {
960 let x_min = f32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
961 let y_min = f32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
962 let x_max = f32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
963 let y_max = f32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
964
965 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(FloatRectrust-analyzer cargo exr 1.74.0 meta/attribute/FloatRect# {
966 minrust-analyzer cargo exr 1.74.0 meta/attribute/FloatRect#min.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(x_min, y_min),
967 maxrust-analyzer cargo exr 1.74.0 meta/attribute/FloatRect#max.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(x_max, y_max)
968 })
969 }
970 }
971
972 impl SampleTyperust-analyzer cargo exr 1.74.0 meta/attribute/SampleType# {
973
974 /// How many bytes a single sample takes up.
975 pub fn bytes_per_samplerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[SampleType]bytes_per_sample().(&self) -> usize {
976 match self {
977 SampleTyperust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#::F16rust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#F16# => f16rust-analyzer cargo half 2.6.0 binary16/f16#::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE.,
978 SampleTyperust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#::F32rust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#F32# => f32::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE.,
979 SampleTyperust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#::U32rust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#U32# => u32::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE.,
980 }
981 }
982
983 /// Number of bytes this would consume in an exr file.
984 pub fn byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[SampleType]byte_size().() -> usize {
985 i32::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE.
986 }
987
988 /// Without validation, write this instance to the byte stream.
989 pub fn writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[SampleType]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, write: &mut W) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
990 match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self {
991 SampleTyperust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#::U32rust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#U32# => 0_i32,
992 SampleTyperust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#::F16rust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#F16# => 1_i32,
993 SampleTyperust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#::F32rust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#F32# => 2_i32,
994 }.write_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
995
996 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
997 }
998
999 /// Read the value without validating.
1000 pub fn readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[SampleType]read().<R: Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#>(read: &mut R) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[SampleType]> {
1001 // there's definitely going to be more than 255 different pixel types in the future
1002 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(match i32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
1003 0 => SampleTyperust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#::U32rust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#U32#,
1004 1 => SampleTyperust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#::F16rust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#F16#,
1005 2 => SampleTyperust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#::F32rust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#F32#,
1006 _ => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("pixel type attribute value")),
1007 })
1008 }
1009 }
1010
1011 impl ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription# {
1012 /// Choose whether to compress samples linearly or not, based on the channel name.
1013 /// Luminance-based channels will be compressed differently than linear data such as alpha.
1014 pub fn guess_quantization_linearityrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]guess_quantization_linearity().(name: &Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#) -> bool {
1015 !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().(
1016 name.eq_case_insensitiverust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]eq_case_insensitive().("R") || name.eq_case_insensitiverust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]eq_case_insensitive().("G") ||
1017 name.eq_case_insensitiverust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]eq_case_insensitive().("B") || name.eq_case_insensitiverust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]eq_case_insensitive().("L") ||
1018 name.eq_case_insensitiverust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]eq_case_insensitive().("Y") || name.eq_case_insensitiverust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]eq_case_insensitive().("X") ||
1019 name.eq_case_insensitiverust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]eq_case_insensitive().("Z")
1020 )
1021 }
1022
1023 /// Create a new channel with the specified properties and a sampling rate of (1,1).
1024 /// Automatically chooses the linearity for compression based on the channel name.
1025 pub fn namedrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]named().(name: impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#>, sample_type: SampleTyperust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#) -> Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription] {
1026 let name = name.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().();
1027 let linearity = Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]::guess_quantization_linearityrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]guess_quantization_linearity().(&name);
1028 Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]::newrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]new().(name, sample_type, linearity)
1029 }
1030
1031 /*pub fn from_name<T: Into<Sample> + Default>(name: impl Into<Text>) -> Self {
1032 Self::named(name, T::default().into().sample_type())
1033 }*/
1034
1035 /// Create a new channel with the specified properties and a sampling rate of (1,1).
1036 pub fn newrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]new().(name: impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#>, sample_type: SampleTyperust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#, quantize_linearly: bool) -> Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription] {
1037 Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription] { namerust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#name.: name.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().(), sample_typerust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sample_type., quantize_linearlyrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#quantize_linearly., samplingrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sampling.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(1, 1) }
1038 }
1039
1040 /// The count of pixels this channel contains, respecting subsampling.
1041 // FIXME this must be used everywhere
1042 pub fn subsampled_pixelsrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]subsampled_pixels().(&self, dimensions: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<usize>) -> usize {
1043 self.subsampled_resolutionrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]subsampled_resolution().(dimensions).arearust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]area().()
1044 }
1045
1046 /// The resolution pf this channel, respecting subsampling.
1047 pub fn subsampled_resolutionrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]subsampled_resolution().(&self, dimensions: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<usize>) -> Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<usize> {
1048 dimensions rust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`][`Div<Self>`]div()./rust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`][`Div<Self>`]div(). rust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`][`Div<Self>`]div().self.samplingrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sampling.
1049 }
1050
1051 /// Number of bytes this would consume in an exr file.
1052 pub fn byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]byte_size().(&self) -> usize {
1053 self.namerust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#name..null_terminated_byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]null_terminated_byte_size().()
1054 +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().SampleTyperust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#::byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[SampleType]byte_size().()
1055 +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().1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().// is_linearrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().
1056 +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().3 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().// reserved bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().
1057 +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().2 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().u32::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE. // sampling x, y
1058 }
1059
1060 /// Without validation, write this instance to the byte stream.
1061 pub fn writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, write: &mut W) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
1062 Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::write_null_terminatedrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]write_null_terminated().(&self.namerust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#name., write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1063 self.sample_typerust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sample_type..writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[SampleType]write().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1064
1065 match self.quantize_linearlyrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#quantize_linearly. {
1066 false => 0_u8,
1067 true => 1_u8,
1068 }.write_lerust-analyzer cargo exr 1.74.0 io/impl#[u8][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1069
1070 i8::write_slice_lerust-analyzer cargo exr 1.74.0 io/impl#[i8][Data]write_slice_le().(write, &[0_i8, 0_i8, 0_i8])?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1071 i32::write_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]write_le().(usize_to_i32rust-analyzer cargo exr 1.74.0 error/usize_to_i32().(self.samplingrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sampling..xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().(), "text length")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1072 i32::write_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]write_le().(usize_to_i32rust-analyzer cargo exr 1.74.0 error/usize_to_i32().(self.samplingrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sampling..yrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]y().(), "text length")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1073 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
1074 }
1075
1076 /// Read the value without validating.
1077 pub fn readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]read().<R: Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#>(read: &mut R) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]> {
1078 let name = Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::read_null_terminatedrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]read_null_terminated().(read, 256)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1079 let sample_type = SampleTyperust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#::readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[SampleType]read().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1080
1081 let is_linear = match u8::read_lerust-analyzer cargo exr 1.74.0 io/impl#[u8][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
1082 1 => true,
1083 0 => false,
1084 _ => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("channel linearity attribute value")),
1085 };
1086
1087 let mut reserved = [0_i8; 3];
1088 i8::read_slice_lerust-analyzer cargo exr 1.74.0 io/impl#[i8][Data]read_slice_le().(read, &mut reserved)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1089
1090 let x_sampling = i32_to_usizerust-analyzer cargo exr 1.74.0 error/i32_to_usize().(i32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., "x channel sampling")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1091 let y_sampling = i32_to_usizerust-analyzer cargo exr 1.74.0 error/i32_to_usize().(i32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., "y channel sampling")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1092
1093 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription# {
1094 namerust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#name., sample_typerust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sample_type.,
1095 quantize_linearlyrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#quantize_linearly.: is_linear,
1096 samplingrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sampling.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(x_sampling, y_sampling),
1097 })
1098 }
1099
1100 /// Validate this instance.
1101 pub fn validaterust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]validate().(&self, allow_sampling: bool, data_window: IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#, strict: bool) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
1102 self.namerust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#name..validaterust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]validate().(true, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; // TODO spec says this does not affect `requirements.long_names` but is that true?
1103
1104 if self.samplingrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sampling..xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().() 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().0 || self.samplingrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sampling..yrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]y().() 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().0 {
1105 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("zero sampling factor"));
1106 }
1107
1108 if strict && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().allow_sampling && self.samplingrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sampling. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(1,1) {
1109 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("subsampling is only allowed in flat scan line images"));
1110 }
1111
1112 if data_window.positionrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#position..xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Rem<Self>`]rem().self.samplingrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sampling..xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().() as i32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().0 || data_window.positionrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#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#[i32][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Rem<Self>`]rem().self.samplingrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sampling..yrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]y().() as i32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().0 {
1113 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("channel sampling factor not dividing data window position"));
1114 }
1115
1116 if data_window.sizerust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#size..xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().self.samplingrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sampling..xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().0 || data_window.sizerust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#size..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][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().self.samplingrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sampling..yrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]y().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().0 {
1117 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("channel sampling factor not dividing data window size"));
1118 }
1119
1120 if self.samplingrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sampling. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(1,1) {
1121 // TODO this must only be implemented in the crate::image module and child modules,
1122 // should not be too difficult
1123
1124 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::unsupportedrust-analyzer cargo exr 1.74.0 error/impl#[Error]unsupported().("channel subsampling not supported yet"));
1125 }
1126
1127 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
1128 }
1129 }
1130
1131 impl ChannelListrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelList# {
1132
1133 /// Number of bytes this would consume in an exr file.
1134 pub fn byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelList]byte_size().(&self) -> usize {
1135 self.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().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#::byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]byte_size().).sumrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#sum().::<usize>() 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().sequence_endrust-analyzer cargo exr 1.74.0 meta/sequence_end/::byte_sizerust-analyzer cargo exr 1.74.0 meta/sequence_end/byte_size().()
1136 }
1137
1138 /// Without validation, write this instance to the byte stream.
1139 /// Assumes channels are sorted alphabetically and all values are validated.
1140 pub fn writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelList]write().(&self, write: &mut impl Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
1141 for channel in &self.listrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelList#list. {
1142 channel.writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]write().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1143 }
1144
1145 sequence_endrust-analyzer cargo exr 1.74.0 meta/sequence_end/::writerust-analyzer cargo exr 1.74.0 meta/sequence_end/write().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1146 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
1147 }
1148
1149 /// Read the value without validating.
1150 pub fn readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelList]read().(read: &mut PeekReadrust-analyzer cargo exr 1.74.0 io/PeekRead#<impl Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#>) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelList]> {
1151 let mut channels = SmallVecrust-analyzer cargo smallvec 1.15.1 SmallVec#::newrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]new().();
1152 while !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().sequence_endrust-analyzer cargo exr 1.74.0 meta/sequence_end/::has_comerust-analyzer cargo exr 1.74.0 meta/sequence_end/has_come().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
1153 channels.pushrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]push().(ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#::readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]read().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().);
1154 }
1155
1156 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ChannelListrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelList#::newrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelList]new().(channels))
1157 }
1158
1159 /// Check if channels are valid and sorted.
1160 pub fn validaterust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelList]validate().(&self, allow_sampling: bool, data_window: IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#, strict: bool) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
1161 let mut iter = self.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().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|chan| chan.validaterust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]validate().(allow_sampling, data_window, strict).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|_| &chan.namerust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#name.));
1162 let mut previous = iter.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/map/impl#[`Map<I, F>`][Iterator]next().().ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("at least one channel is required"))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1163
1164 for result in iter {
1165 let value = result?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1166 if strict && previous rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().value { return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("channel names are not unique")); }
1167 else if previous rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]gt().value { return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("channel names are not sorted alphabetically")); }
1168 else { previous = value; }
1169 }
1170
1171 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
1172 }
1173 }
1174
1175 fn u8_to_decimal32rust-analyzer cargo exr 1.74.0 meta/attribute/u8_to_decimal32().(binary: u8) -> u32 {
1176 let units = binary as u32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().10;
1177 let tens = (binary as u32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div().10) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().10;
1178 units rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().(tens rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().4)
1179 }
1180
1181 // assumes value fits into u8
1182 fn u8_from_decimal32rust-analyzer cargo exr 1.74.0 meta/attribute/u8_from_decimal32().(coded: u32) -> u8 {
1183 ((coded rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().0x0f) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().10 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().((coded rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().4) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().0x0f)) as u8
1184 }
1185
1186 // https://github.com/AcademySoftwareFoundation/openexr/blob/master/src/lib/OpenEXR/ImfTimeCode.cpp
1187 impl TimeCoderust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode# {
1188
1189 /// Number of bytes this would consume in an exr file.
1190 pub const BYTE_SIZErust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]BYTE_SIZE.: usize = 2 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().u32::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE.;
1191
1192 /// Returns an error if this time code is considered invalid.
1193 pub fn validaterust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]validate().(&self, strict: bool) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
1194 if strict {
1195 if self.framerust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#frame. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt().29 { Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("time code frame larger than 29")) }
1196 else if self.secondsrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#seconds. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt().59 { Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("time code seconds larger than 59")) }
1197 else if self.minutesrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#minutes. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt().59 { Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("time code minutes larger than 59")) }
1198 else if self.hoursrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#hours. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt().23 { Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("time code hours larger than 23")) }
1199 else if self.binary_groupsrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#binary_groups..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]any().(|&group| group rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt().15) {
1200 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("time code binary group value too large for 3 bits"))
1201 }
1202 else { Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) }
1203 }
1204 else { Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) }
1205 }
1206
1207
1208 /// Pack the SMPTE time code into a u32 value, according to TV60 packing.
1209 /// This is the encoding which is used within a binary exr file.
1210 pub fn pack_time_as_tv60_u32rust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]pack_time_as_tv60_u32().(&self) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<u32> {
1211 // validate strictly to prevent set_bit panic! below
1212 self.validaterust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]validate().(true)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1213
1214 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().0_u32
1215 .set_bitsrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]set_bits().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#6, u8_to_decimal32rust-analyzer cargo exr 1.74.0 meta/attribute/u8_to_decimal32().(self.framerust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#frame.))
1216 .set_bitrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]set_bit().(6, self.drop_framerust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#drop_frame.)
1217 .set_bitrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]set_bit().(7, self.color_framerust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#color_frame.)
1218 .set_bitsrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]set_bits().(8..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#15, u8_to_decimal32rust-analyzer cargo exr 1.74.0 meta/attribute/u8_to_decimal32().(self.secondsrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#seconds.))
1219 .set_bitrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]set_bit().(15, self.field_phaserust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#field_phase.)
1220 .set_bitsrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]set_bits().(16..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#23, u8_to_decimal32rust-analyzer cargo exr 1.74.0 meta/attribute/u8_to_decimal32().(self.minutesrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#minutes.))
1221 .set_bitrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]set_bit().(23, self.binary_group_flagsrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#binary_group_flags.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().)
1222 .set_bitsrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]set_bits().(24..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#30, u8_to_decimal32rust-analyzer cargo exr 1.74.0 meta/attribute/u8_to_decimal32().(self.hoursrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#hours.))
1223 .set_bitrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]set_bit().(30, self.binary_group_flagsrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#binary_group_flags.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().)
1224 .set_bitrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]set_bit().(31, self.binary_group_flagsrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#binary_group_flags.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().)
1225 )
1226 }
1227
1228 /// Unpack a time code from one TV60 encoded u32 value and the encoded user data.
1229 /// This is the encoding which is used within a binary exr file.
1230 pub fn from_tv60_timerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]from_tv60_time().(tv60_time: u32, user_data: u32) -> Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode] {
1231 Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode] {
1232 framerust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#frame.: u8_from_decimal32rust-analyzer cargo exr 1.74.0 meta/attribute/u8_from_decimal32().(tv60_time.get_bitsrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]get_bits().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#6)), // cast cannot fail, as these are less than 8 bits
1233 drop_framerust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#drop_frame.: tv60_time.get_bitrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]get_bit().(6),
1234 color_framerust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#color_frame.: tv60_time.get_bitrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]get_bit().(7),
1235 secondsrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#seconds.: u8_from_decimal32rust-analyzer cargo exr 1.74.0 meta/attribute/u8_from_decimal32().(tv60_time.get_bitsrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]get_bits().(8..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#15)), // cast cannot fail, as these are less than 8 bits
1236 field_phaserust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#field_phase.: tv60_time.get_bitrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]get_bit().(15),
1237 minutesrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#minutes.: u8_from_decimal32rust-analyzer cargo exr 1.74.0 meta/attribute/u8_from_decimal32().(tv60_time.get_bitsrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]get_bits().(16..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#23)), // cast cannot fail, as these are less than 8 bits
1238 hoursrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#hours.: u8_from_decimal32rust-analyzer cargo exr 1.74.0 meta/attribute/u8_from_decimal32().(tv60_time.get_bitsrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]get_bits().(24..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#30)), // cast cannot fail, as these are less than 8 bits
1239 binary_group_flagsrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#binary_group_flags.: [
1240 tv60_time.get_bitrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]get_bit().(23),
1241 tv60_time.get_bitrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]get_bit().(30),
1242 tv60_time.get_bitrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]get_bit().(31),
1243 ],
1244
1245 binary_groupsrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#binary_groups.: Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]::unpack_user_data_from_u32rust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]unpack_user_data_from_u32().(user_data)
1246 }
1247 }
1248
1249 /// Pack the SMPTE time code into a u32 value, according to TV50 packing.
1250 /// This encoding does not support the `drop_frame` flag, it will be lost.
1251 pub fn pack_time_as_tv50_u32rust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]pack_time_as_tv50_u32().(&self) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<u32> {
1252 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().self.pack_time_as_tv60_u32rust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]pack_time_as_tv60_u32().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
1253
1254 // swap some fields by replacing some bits in the packed u32
1255 .set_bitrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]set_bit().(6, false)
1256 .set_bitrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]set_bit().(15, self.binary_group_flagsrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#binary_group_flags.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().)
1257 .set_bitrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]set_bit().(30, self.binary_group_flagsrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#binary_group_flags.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().)
1258 .set_bitrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]set_bit().(23, self.binary_group_flagsrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#binary_group_flags.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().)
1259 .set_bitrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]set_bit().(31, self.field_phaserust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#field_phase.)
1260 )
1261 }
1262
1263 /// Unpack a time code from one TV50 encoded u32 value and the encoded user data.
1264 /// This encoding does not support the `drop_frame` flag, it will always be false.
1265 pub fn from_tv50_timerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]from_tv50_time().(tv50_time: u32, user_data: u32) -> Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode] {
1266 Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode] {
1267 drop_framerust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#drop_frame.: false, // do not use bit [6]
1268
1269 // swap some fields:
1270 field_phaserust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#field_phase.: tv50_time.get_bitrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]get_bit().(31),
1271 binary_group_flagsrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#binary_group_flags.: [
1272 tv50_time.get_bitrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]get_bit().(15),
1273 tv50_time.get_bitrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]get_bit().(30),
1274 tv50_time.get_bitrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]get_bit().(23),
1275 ],
1276
1277 .. Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]::from_tv60_timerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]from_tv60_time().(tv50_time, user_data)
1278 }
1279 }
1280
1281
1282 /// Pack the SMPTE time code into a u32 value, according to FILM24 packing.
1283 /// This encoding does not support the `drop_frame` and `color_frame` flags, they will be lost.
1284 pub fn pack_time_as_film24_u32rust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]pack_time_as_film24_u32().(&self) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<u32> {
1285 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().self.pack_time_as_tv60_u32rust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]pack_time_as_tv60_u32().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
1286 .set_bitrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]set_bit().(6, false)
1287 .set_bitrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]set_bit().(7, false)
1288 )
1289 }
1290
1291 /// Unpack a time code from one TV60 encoded u32 value and the encoded user data.
1292 /// This encoding does not support the `drop_frame` and `color_frame` flags, they will always be `false`.
1293 pub fn from_film24_timerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]from_film24_time().(film24_time: u32, user_data: u32) -> Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode] {
1294 Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode] {
1295 drop_framerust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#drop_frame.: false, // bit [6]
1296 color_framerust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#color_frame.: false, // bit [7]
1297 .. Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]::from_tv60_timerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]from_tv60_time().(film24_time, user_data)
1298 }
1299 }
1300
1301
1302 // in rust, group index starts at zero, not at one.
1303 fn user_data_bit_indicesrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]user_data_bit_indices().(group_index: usize) -> 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#<usize> {
1304 let min_bit = 4 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().group_index;
1305 min_bit 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#min_bit 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().4 // +4, not +3, as `Range` is exclusive
1306 }
1307
1308 /// Pack the user data `u8` array into one u32.
1309 /// User data values are clamped to the valid range (maximum value is 4).
1310 pub fn pack_user_data_as_u32rust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]pack_user_data_as_u32().(&self) -> u32 {
1311 let packed = self.binary_groupsrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#binary_groups..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().().foldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/enumerate/impl#[`Enumerate<I>`][Iterator]fold().(0_u32, |mut packed, (group_index, group_value)|
1312 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().packed.set_bitsrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]set_bits().(Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]::user_data_bit_indicesrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]user_data_bit_indices().(group_index), *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().group_value.minrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#min().(&15) as u32)
1313 );
1314
1315 debug_assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert_eq!!(Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]::unpack_user_data_from_u32rust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]unpack_user_data_from_u32().(packed), self.binary_groupsrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#binary_groups., "round trip user data encoding");
1316 packed
1317 }
1318
1319 // Unpack the encoded u32 user data to an array of bytes, each byte having a value from 0 to 4.
1320 fn unpack_user_data_from_u32rust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]unpack_user_data_from_u32().(user_data: u32) -> [u8; 8] {
1321 (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#8).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|group_index| user_data.get_bitsrust-analyzer cargo bit_field 0.10.3 impl#[u32][BitField]get_bits().(Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]::user_data_bit_indicesrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]user_data_bit_indices().(group_index)) as u8)
1322 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<SmallVecrust-analyzer cargo smallvec 1.15.1 SmallVec#<[u8;8]>>().into_innerrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]into_inner().().expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("array index bug")
1323 }
1324
1325
1326 /// Write this time code to the byte stream, encoded as TV60 integers.
1327 /// Returns an `Error::Invalid` if the fields are out of the allowed range.
1328 pub fn writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, write: &mut W) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
1329 self.pack_time_as_tv60_u32rust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]pack_time_as_tv60_u32().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..write_lerust-analyzer cargo exr 1.74.0 io/impl#[u32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; // will validate
1330 self.pack_user_data_as_u32rust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]pack_user_data_as_u32().().write_lerust-analyzer cargo exr 1.74.0 io/impl#[u32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1331 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
1332 }
1333
1334 /// Read the time code, without validating, extracting from TV60 integers.
1335 pub fn readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]read().<R: Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#>(read: &mut R) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]> {
1336 let time_and_flags = u32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[u32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1337 let user_data = u32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[u32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1338 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]::from_tv60_timerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]from_tv60_time().(time_and_flags, user_data))
1339 }
1340 }
1341
1342 impl Chromaticitiesrust-analyzer cargo exr 1.74.0 meta/attribute/Chromaticities# {
1343
1344 /// Number of bytes this would consume in an exr file.
1345 pub fn byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Chromaticities]byte_size().() -> usize {
1346 8 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().f32::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE.
1347 }
1348
1349 /// Without validation, write this instance to the byte stream.
1350 pub fn writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Chromaticities]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, write: &mut W) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
1351 self.redrust-analyzer cargo exr 1.74.0 meta/attribute/Chromaticities#red..xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().().write_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1352 self.redrust-analyzer cargo exr 1.74.0 meta/attribute/Chromaticities#red..yrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]y().().write_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1353
1354 self.greenrust-analyzer cargo exr 1.74.0 meta/attribute/Chromaticities#green..xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().().write_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1355 self.greenrust-analyzer cargo exr 1.74.0 meta/attribute/Chromaticities#green..yrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]y().().write_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1356
1357 self.bluerust-analyzer cargo exr 1.74.0 meta/attribute/Chromaticities#blue..xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().().write_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1358 self.bluerust-analyzer cargo exr 1.74.0 meta/attribute/Chromaticities#blue..yrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]y().().write_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1359
1360 self.whiterust-analyzer cargo exr 1.74.0 meta/attribute/Chromaticities#white..xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().().write_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1361 self.whiterust-analyzer cargo exr 1.74.0 meta/attribute/Chromaticities#white..yrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]y().().write_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1362 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
1363 }
1364
1365 /// Read the value without validating.
1366 pub fn readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Chromaticities]read().<R: Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#>(read: &mut R) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Chromaticities]> {
1367 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Chromaticitiesrust-analyzer cargo exr 1.74.0 meta/attribute/Chromaticities# {
1368 redrust-analyzer cargo exr 1.74.0 meta/attribute/Chromaticities#red.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(f32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., f32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().),
1369 greenrust-analyzer cargo exr 1.74.0 meta/attribute/Chromaticities#green.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(f32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., f32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().),
1370 bluerust-analyzer cargo exr 1.74.0 meta/attribute/Chromaticities#blue.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(f32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., f32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().),
1371 whiterust-analyzer cargo exr 1.74.0 meta/attribute/Chromaticities#white.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(f32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., f32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().),
1372 })
1373 }
1374 }
1375
1376 impl Compressionrust-analyzer cargo exr 1.74.0 compression/Compression# {
1377
1378 /// Number of bytes this would consume in an exr file.
1379 pub fn byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Compression]byte_size().() -> usize { u8::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE. }
1380
1381 /// Without validation, write this instance to the byte stream.
1382 pub fn writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Compression]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(self, write: &mut W) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
1383 use selfrust-analyzer cargo exr 1.74.0 meta/attribute/::Compressionrust-analyzer cargo exr 1.74.0 compression/Compression#::*;
1384 match self {
1385 Uncompressedrust-analyzer cargo exr 1.74.0 compression/Compression#Uncompressed# => 0_u8,
1386 RLErust-analyzer cargo exr 1.74.0 compression/Compression#RLE# => 1_u8,
1387 ZIP1rust-analyzer cargo exr 1.74.0 compression/Compression#ZIP1# => 2_u8,
1388 ZIP16rust-analyzer cargo exr 1.74.0 compression/Compression#ZIP16# => 3_u8,
1389 PIZrust-analyzer cargo exr 1.74.0 compression/Compression#PIZ# => 4_u8,
1390 PXR24rust-analyzer cargo exr 1.74.0 compression/Compression#PXR24# => 5_u8,
1391 B44rust-analyzer cargo exr 1.74.0 compression/Compression#B44# => 6_u8,
1392 B44Arust-analyzer cargo exr 1.74.0 compression/Compression#B44A# => 7_u8,
1393 DWAArust-analyzer cargo exr 1.74.0 compression/Compression#DWAA#(_) => 8_u8,
1394 DWABrust-analyzer cargo exr 1.74.0 compression/Compression#DWAB#(_) => 9_u8,
1395 HTJ2K256rust-analyzer cargo exr 1.74.0 compression/Compression#HTJ2K256# => 10_u8,
1396 HTJ2K32rust-analyzer cargo exr 1.74.0 compression/Compression#HTJ2K32# => 11_u8,
1397 }.write_lerust-analyzer cargo exr 1.74.0 io/impl#[u8][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1398 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
1399 }
1400
1401 /// Read the value without validating.
1402 pub fn readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Compression]read().<R: Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#>(read: &mut R) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Compression]> {
1403 use selfrust-analyzer cargo exr 1.74.0 meta/attribute/::Compressionrust-analyzer cargo exr 1.74.0 compression/Compression#::*;
1404 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(match u8::read_lerust-analyzer cargo exr 1.74.0 io/impl#[u8][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
1405 0 => Uncompressedrust-analyzer cargo exr 1.74.0 compression/Compression#Uncompressed#,
1406 1 => RLErust-analyzer cargo exr 1.74.0 compression/Compression#RLE#,
1407 2 => ZIP1rust-analyzer cargo exr 1.74.0 compression/Compression#ZIP1#,
1408 3 => ZIP16rust-analyzer cargo exr 1.74.0 compression/Compression#ZIP16#,
1409 4 => PIZrust-analyzer cargo exr 1.74.0 compression/Compression#PIZ#,
1410 5 => PXR24rust-analyzer cargo exr 1.74.0 compression/Compression#PXR24#,
1411 6 => B44rust-analyzer cargo exr 1.74.0 compression/Compression#B44#,
1412 7 => B44Arust-analyzer cargo exr 1.74.0 compression/Compression#B44A#,
1413 8 => DWAArust-analyzer cargo exr 1.74.0 compression/Compression#DWAA#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#),
1414 9 => DWABrust-analyzer cargo exr 1.74.0 compression/Compression#DWAB#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#),
1415 10 => HTJ2K256rust-analyzer cargo exr 1.74.0 compression/Compression#HTJ2K256#,
1416 11 => HTJ2K32rust-analyzer cargo exr 1.74.0 compression/Compression#HTJ2K32#,
1417 _ => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::unsupportedrust-analyzer cargo exr 1.74.0 error/impl#[Error]unsupported().("unknown compression method")),
1418 })
1419 }
1420 }
1421
1422 impl EnvironmentMaprust-analyzer cargo exr 1.74.0 meta/attribute/EnvironmentMap# {
1423
1424 /// Number of bytes this would consume in an exr file.
1425 pub fn byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[EnvironmentMap]byte_size().() -> usize {
1426 u8::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE.
1427 }
1428
1429 /// Without validation, write this instance to the byte stream.
1430 pub fn writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[EnvironmentMap]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(self, write: &mut W) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
1431 use selfrust-analyzer cargo exr 1.74.0 meta/attribute/::EnvironmentMaprust-analyzer cargo exr 1.74.0 meta/attribute/EnvironmentMap#::*;
1432 match self {
1433 LatitudeLongituderust-analyzer cargo exr 1.74.0 meta/attribute/EnvironmentMap#LatitudeLongitude# => 0_u8,
1434 Cuberust-analyzer cargo exr 1.74.0 meta/attribute/EnvironmentMap#Cube# => 1_u8
1435 }.write_lerust-analyzer cargo exr 1.74.0 io/impl#[u8][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1436
1437 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
1438 }
1439
1440 /// Read the value without validating.
1441 pub fn readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[EnvironmentMap]read().<R: Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#>(read: &mut R) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[EnvironmentMap]> {
1442 use selfrust-analyzer cargo exr 1.74.0 meta/attribute/::EnvironmentMaprust-analyzer cargo exr 1.74.0 meta/attribute/EnvironmentMap#::*;
1443 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(match u8::read_lerust-analyzer cargo exr 1.74.0 io/impl#[u8][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
1444 0 => LatitudeLongituderust-analyzer cargo exr 1.74.0 meta/attribute/EnvironmentMap#LatitudeLongitude#,
1445 1 => Cuberust-analyzer cargo exr 1.74.0 meta/attribute/EnvironmentMap#Cube#,
1446 _ => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("environment map attribute value")),
1447 })
1448 }
1449 }
1450
1451 impl KeyCoderust-analyzer cargo exr 1.74.0 meta/attribute/KeyCode# {
1452
1453 /// Number of bytes this would consume in an exr file.
1454 pub fn byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[KeyCode]byte_size().() -> usize {
1455 6 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().i32::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE.
1456 }
1457
1458 /// Without validation, write this instance to the byte stream.
1459 pub fn writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[KeyCode]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, write: &mut W) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
1460 self.film_manufacturer_coderust-analyzer cargo exr 1.74.0 meta/attribute/KeyCode#film_manufacturer_code..write_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1461 self.film_typerust-analyzer cargo exr 1.74.0 meta/attribute/KeyCode#film_type..write_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1462 self.film_roll_prefixrust-analyzer cargo exr 1.74.0 meta/attribute/KeyCode#film_roll_prefix..write_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1463 self.countrust-analyzer cargo exr 1.74.0 meta/attribute/KeyCode#count..write_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1464 self.perforation_offsetrust-analyzer cargo exr 1.74.0 meta/attribute/KeyCode#perforation_offset..write_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1465 self.perforations_per_countrust-analyzer cargo exr 1.74.0 meta/attribute/KeyCode#perforations_per_count..write_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1466 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
1467 }
1468
1469 /// Read the value without validating.
1470 pub fn readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[KeyCode]read().<R: Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#>(read: &mut R) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[KeyCode]> {
1471 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(KeyCoderust-analyzer cargo exr 1.74.0 meta/attribute/KeyCode# {
1472 film_manufacturer_coderust-analyzer cargo exr 1.74.0 meta/attribute/KeyCode#film_manufacturer_code.: i32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1473 film_typerust-analyzer cargo exr 1.74.0 meta/attribute/KeyCode#film_type.: i32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1474 film_roll_prefixrust-analyzer cargo exr 1.74.0 meta/attribute/KeyCode#film_roll_prefix.: i32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1475 countrust-analyzer cargo exr 1.74.0 meta/attribute/KeyCode#count.: i32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1476 perforation_offsetrust-analyzer cargo exr 1.74.0 meta/attribute/KeyCode#perforation_offset.: i32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1477 perforations_per_framerust-analyzer cargo exr 1.74.0 meta/attribute/KeyCode#perforations_per_frame.: i32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1478 perforations_per_countrust-analyzer cargo exr 1.74.0 meta/attribute/KeyCode#perforations_per_count.: i32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1479 })
1480 }
1481 }
1482
1483 impl LineOrderrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder# {
1484
1485 /// Number of bytes this would consume in an exr file.
1486 pub fn byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[LineOrder]byte_size().() -> usize {
1487 u8::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE.
1488 }
1489
1490 /// Without validation, write this instance to the byte stream.
1491 pub fn writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[LineOrder]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(self, write: &mut W) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
1492 use selfrust-analyzer cargo exr 1.74.0 meta/attribute/::LineOrderrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#::*;
1493 match self {
1494 Increasingrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#Increasing# => 0_u8,
1495 Decreasingrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#Decreasing# => 1_u8,
1496 Unspecifiedrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#Unspecified# => 2_u8,
1497 }.write_lerust-analyzer cargo exr 1.74.0 io/impl#[u8][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1498
1499 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
1500 }
1501
1502 /// Read the value without validating.
1503 pub fn readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[LineOrder]read().<R: Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#>(read: &mut R) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[LineOrder]> {
1504 use selfrust-analyzer cargo exr 1.74.0 meta/attribute/::LineOrderrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#::*;
1505 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(match u8::read_lerust-analyzer cargo exr 1.74.0 io/impl#[u8][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
1506 0 => Increasingrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#Increasing#,
1507 1 => Decreasingrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#Decreasing#,
1508 2 => Unspecifiedrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#Unspecified#,
1509 _ => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("line order attribute value")),
1510 })
1511 }
1512 }
1513
1514
1515
1516
1517 impl Previewrust-analyzer cargo exr 1.74.0 meta/attribute/Preview# {
1518
1519 /// Number of bytes this would consume in an exr file.
1520 pub fn byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Preview]byte_size().(&self) -> usize {
1521 2 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().u32::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE. 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().self.pixel_datarust-analyzer cargo exr 1.74.0 meta/attribute/Preview#pixel_data..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().()
1522 }
1523
1524 /// Without validation, write this instance to the byte stream.
1525 pub fn writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Preview]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, write: &mut W) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
1526 u32::write_lerust-analyzer cargo exr 1.74.0 io/impl#[u32][Data]write_le().(self.sizerust-analyzer cargo exr 1.74.0 meta/attribute/Preview#size..widthrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]width().() as u32, write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1527 u32::write_lerust-analyzer cargo exr 1.74.0 io/impl#[u32][Data]write_le().(self.sizerust-analyzer cargo exr 1.74.0 meta/attribute/Preview#size..heightrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]height().() as u32, write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1528
1529 i8::write_slice_lerust-analyzer cargo exr 1.74.0 io/impl#[i8][Data]write_slice_le().(write, &self.pixel_datarust-analyzer cargo exr 1.74.0 meta/attribute/Preview#pixel_data.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1530 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
1531 }
1532
1533 /// Read the value without validating.
1534 pub fn readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Preview]read().<R: Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#>(read: &mut R) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Preview]> {
1535 let width = u32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[u32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). as usize;
1536 let height = u32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[u32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). as usize;
1537
1538 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(pixel_count) = width.checked_mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]checked_mul().(height) {
1539 // Multiply by the number of bytes per pixel.
1540 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(byte_count) = pixel_count.checked_mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]checked_mul().(4) {
1541 let pixel_data = i8::read_vec_lerust-analyzer cargo exr 1.74.0 io/Data#read_vec_le().(
1542 read,
1543 byte_count,
1544 1024 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().1024 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().4,
1545 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
1546 "preview attribute pixel count",
1547 )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1548
1549 let preview = Previewrust-analyzer cargo exr 1.74.0 meta/attribute/Preview# {
1550 sizerust-analyzer cargo exr 1.74.0 meta/attribute/Preview#size.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(width, height),
1551 pixel_datarust-analyzer cargo exr 1.74.0 meta/attribute/Preview#pixel_data.,
1552 };
1553
1554 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(preview);
1555 }
1556 }
1557
1558 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().(
1559 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("Overflow while calculating preview image Attribute size \
1560 (width: {}, height: {}).",
1561 width,
1562 height)));
1563 }
1564
1565 /// Validate this instance.
1566 pub fn validaterust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Preview]validate().(&self, strict: bool) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
1567 if strict && (self.sizerust-analyzer cargo exr 1.74.0 meta/attribute/Preview#size..arearust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]area().() 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().4 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().self.pixel_datarust-analyzer cargo exr 1.74.0 meta/attribute/Preview#pixel_data..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().()) {
1568 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("preview dimensions do not match content length"))
1569 }
1570
1571 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
1572 }
1573 }
1574
1575 impl ::stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for Previewrust-analyzer cargo exr 1.74.0 meta/attribute/Preview# {
1576 fn fmtrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Preview][Debug]fmt().(&self, f: &mut ::stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> ::stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
1577 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "Preview ({}x{} px)", self.sizerust-analyzer cargo exr 1.74.0 meta/attribute/Preview#size..widthrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]width().(), self.sizerust-analyzer cargo exr 1.74.0 meta/attribute/Preview#size..heightrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]height().())
1578 }
1579 }
1580
1581 impl TileDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription# {
1582
1583 /// Number of bytes this would consume in an exr file.
1584 pub fn byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TileDescription]byte_size().() -> usize {
1585 2 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().u32::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE. 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().1 // size x,y + (level mode + rounding mode)
1586 }
1587
1588 /// Without validation, write this instance to the byte stream.
1589 pub fn writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TileDescription]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, write: &mut W) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
1590 u32::write_lerust-analyzer cargo exr 1.74.0 io/impl#[u32][Data]write_le().(self.tile_sizerust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription#tile_size..widthrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]width().() as u32, write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1591 u32::write_lerust-analyzer cargo exr 1.74.0 io/impl#[u32][Data]write_le().(self.tile_sizerust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription#tile_size..heightrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]height().() as u32, write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1592
1593 let level_mode = match self.level_moderust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription#level_mode. {
1594 LevelModerust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#::Singularrust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#Singular# => 0_u8,
1595 LevelModerust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#::MipMaprust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#MipMap# => 1_u8,
1596 LevelModerust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#::RipMaprust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#RipMap# => 2_u8,
1597 };
1598
1599 let rounding_mode = match self.rounding_moderust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription#rounding_mode. {
1600 RoundingModerust-analyzer cargo exr 1.74.0 math/RoundingMode#::Downrust-analyzer cargo exr 1.74.0 math/RoundingMode#Down# => 0_u8,
1601 RoundingModerust-analyzer cargo exr 1.74.0 math/RoundingMode#::Uprust-analyzer cargo exr 1.74.0 math/RoundingMode#Up# => 1_u8,
1602 };
1603
1604 let mode: u8 = level_mode rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add().(rounding_mode rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Mul<Self>`]mul().16);
1605 mode.write_lerust-analyzer cargo exr 1.74.0 io/impl#[u8][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1606 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
1607 }
1608
1609 /// Read the value without validating.
1610 pub fn readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TileDescription]read().<R: Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#>(read: &mut R) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TileDescription]> {
1611 let x_size = u32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[u32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). as usize;
1612 let y_size = u32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[u32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). as usize;
1613
1614 let mode = u8::read_lerust-analyzer cargo exr 1.74.0 io/impl#[u8][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1615
1616 // wow you really saved that one byte here
1617 // mode = level_mode + (rounding_mode * 16)
1618 let level_mode = mode rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().0b00001111; // wow that works
1619 let rounding_mode = mode rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shr<i32>`]shr().4; // wow that works
1620
1621 let level_mode = match level_mode {
1622 0 => LevelModerust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#::Singularrust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#Singular#,
1623 1 => LevelModerust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#::MipMaprust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#MipMap#,
1624 2 => LevelModerust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#::RipMaprust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#RipMap#,
1625 _ => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("tile description level mode")),
1626 };
1627
1628 let rounding_mode = match rounding_mode {
1629 0 => RoundingModerust-analyzer cargo exr 1.74.0 math/RoundingMode#::Downrust-analyzer cargo exr 1.74.0 math/RoundingMode#Down#,
1630 1 => RoundingModerust-analyzer cargo exr 1.74.0 math/RoundingMode#::Uprust-analyzer cargo exr 1.74.0 math/RoundingMode#Up#,
1631 _ => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("tile description rounding mode")),
1632 };
1633
1634 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(TileDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription# { tile_sizerust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription#tile_size.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(x_size, y_size), level_moderust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription#level_mode., rounding_moderust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription#rounding_mode., })
1635 }
1636
1637 /// Validate this instance.
1638 pub fn validaterust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TileDescription]validate().(&self) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
1639 let max = i32::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]MAX. as i64 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][`Div<Self>`]div().2;
1640
1641 if self.tile_sizerust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription#tile_size..widthrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]width().() 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().0 || self.tile_sizerust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription#tile_size..heightrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]height().() 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().0
1642 || self.tile_sizerust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription#tile_size..widthrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]width().() as i64 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]ge().max || self.tile_sizerust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription#tile_size..heightrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]height().() as i64 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]ge().max
1643 {
1644 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("tile size"))
1645 }
1646
1647 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
1648 }
1649 }
1650
1651
1652 /// Number of bytes this attribute would consume in an exr file.
1653 // TODO instead of pre calculating byte size, write to a tmp buffer whose length is inspected before actually writing?
1654 pub fn byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/byte_size().(name: &Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#, value: &AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#) -> usize {
1655 name.null_terminated_byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]null_terminated_byte_size().()
1656 +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().value.kind_namerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[AttributeValue]kind_name().().lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() 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().sequence_endrust-analyzer cargo exr 1.74.0 meta/sequence_end/::byte_sizerust-analyzer cargo exr 1.74.0 meta/sequence_end/byte_size().()
1657 +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().i32::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().// serialized byte sizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().
1658 +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().value.byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[AttributeValue]byte_size().()
1659 }
1660
1661 /// Without validation, write this attribute to the byte stream.
1662 pub fn writerust-analyzer cargo exr 1.74.0 meta/attribute/write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(name: &TextSlicerust-analyzer cargo exr 1.74.0 meta/attribute/TextSlice#, value: &AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#, write: &mut W) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
1663 Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::write_null_terminated_bytesrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]write_null_terminated_bytes().(name, write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1664 Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::write_null_terminated_bytesrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]write_null_terminated_bytes().(value.kind_namerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[AttributeValue]kind_name().(), write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1665 i32::write_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]write_le().(value.byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[AttributeValue]byte_size().() as i32, write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1666 value.writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[AttributeValue]write().(write)
1667 }
1668
1669 /// Read the attribute without validating. The result may be `Ok` even if this single attribute is invalid.
1670 pub fn readrust-analyzer cargo exr 1.74.0 meta/attribute/read().(read: &mut PeekReadrust-analyzer cargo exr 1.74.0 io/PeekRead#<impl Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#>, max_size: usize) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<(Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#, Resultrust-analyzer cargo exr 1.74.0 error/Result#<AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#>)> {
1671 let name = Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::read_null_terminatedrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]read_null_terminated().(read, max_size)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1672 let kind = Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::read_null_terminatedrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]read_null_terminated().(read, max_size)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1673 let size = i32_to_usizerust-analyzer cargo exr 1.74.0 error/i32_to_usize().(i32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]read_le().(read)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., "attribute size")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1674 let value = AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#::readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[AttributeValue]read().(read, kind, size)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1675 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((name, value))
1676 }
1677
1678 /// Validate this attribute.
1679 pub fn validaterust-analyzer cargo exr 1.74.0 meta/attribute/validate().(name: &Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#, value: &AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#, long_names: &mut bool, allow_sampling: bool, data_window: IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#, strict: bool) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
1680 name.validaterust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]validate().(true, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(long_names))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; // only name text has length restriction
1681 value.validaterust-analyzer cargo exr 1.74.0 meta/attribute/impl#[AttributeValue]validate().(allow_sampling, data_window, strict) // attribute value text length is never restricted
1682 }
1683
1684
1685 impl AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue# {
1686
1687 /// Number of bytes this would consume in an exr file.
1688 pub fn byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[AttributeValue]byte_size().(&self) -> usize {
1689 use selfrust-analyzer cargo exr 1.74.0 meta/attribute/::AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#::*;
1690
1691 match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self {
1692 IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#IntegerBounds#(_) => selfrust-analyzer cargo exr 1.74.0 meta/attribute/::IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#::byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]byte_size().(),
1693 FloatRectrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#FloatRect#(_) => selfrust-analyzer cargo exr 1.74.0 meta/attribute/::FloatRectrust-analyzer cargo exr 1.74.0 meta/attribute/FloatRect#::byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[FloatRect]byte_size().(),
1694
1695 I32rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#I32#(_) => i32::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE.,
1696 F32rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#F32#(_) => f32::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE.,
1697 F64rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#F64#(_) => f64::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE.,
1698
1699 Rationalrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Rational#(_) => { i32::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE. 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().u32::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE. },
1700 TimeCoderust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#TimeCode#(_) => selfrust-analyzer cargo exr 1.74.0 meta/attribute/::TimeCoderust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#::BYTE_SIZErust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]BYTE_SIZE.,
1701
1702 IntVec2rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#IntVec2#(_) => { 2 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().i32::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE. },
1703 FloatVec2rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#FloatVec2#(_) => { 2 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().f32::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE. },
1704 IntVec3rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#IntVec3#(_) => { 3 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().i32::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE. },
1705 FloatVec3rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#FloatVec3#(_) => { 3 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().f32::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE. },
1706
1707 ChannelListrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#ChannelList#(ref channels) => channels.byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelList]byte_size().(),
1708 Chromaticitiesrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Chromaticities#(_) => selfrust-analyzer cargo exr 1.74.0 meta/attribute/::Chromaticitiesrust-analyzer cargo exr 1.74.0 meta/attribute/Chromaticities#::byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Chromaticities]byte_size().(),
1709 Compressionrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Compression#(_) => selfrust-analyzer cargo exr 1.74.0 meta/attribute/::Compressionrust-analyzer cargo exr 1.74.0 compression/Compression#::byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Compression]byte_size().(),
1710 EnvironmentMaprust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#EnvironmentMap#(_) => selfrust-analyzer cargo exr 1.74.0 meta/attribute/::EnvironmentMaprust-analyzer cargo exr 1.74.0 meta/attribute/EnvironmentMap#::byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[EnvironmentMap]byte_size().(),
1711
1712 KeyCoderust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#KeyCode#(_) => selfrust-analyzer cargo exr 1.74.0 meta/attribute/::KeyCoderust-analyzer cargo exr 1.74.0 meta/attribute/KeyCode#::byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[KeyCode]byte_size().(),
1713 LineOrderrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#LineOrder#(_) => selfrust-analyzer cargo exr 1.74.0 meta/attribute/::LineOrderrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#::byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[LineOrder]byte_size().(),
1714
1715 Matrix3x3rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Matrix3x3#(ref value) => value.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() 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().f32::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE.,
1716 Matrix4x4rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Matrix4x4#(ref value) => value.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() 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().f32::BYTE_SIZErust-analyzer cargo exr 1.74.0 io/Data#BYTE_SIZE.,
1717
1718 Previewrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Preview#(ref value) => value.byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Preview]byte_size().(),
1719
1720 // attribute value texts never have limited size.
1721 // also, don't serialize size, as it can be inferred from attribute size
1722 Textrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Text#(ref value) => value.bytesrust-analyzer cargo exr 1.74.0 meta/attribute/Text#bytes..lenrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]len().(),
1723
1724 TextVectorrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#TextVector#(ref value) => value.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(selfrust-analyzer cargo exr 1.74.0 meta/attribute/::Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::i32_sized_byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]i32_sized_byte_size().).sumrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#sum().(),
1725 TileDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#TileDescription#(_) => selfrust-analyzer cargo exr 1.74.0 meta/attribute/::TileDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription#::byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TileDescription]byte_size().(),
1726 Customrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Custom# { ref bytesrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Custom#bytes., .. } => bytes.lenrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]len().(),
1727 BlockTyperust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#BlockType#(ref kind) => kind.byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[BlockType]byte_size().(),
1728
1729 Bytesrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Bytes# { ref bytesrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Bytes#bytes., ref type_hintrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Bytes#type_hint. } =>
1730 type_hint.u32_sized_byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]u32_sized_byte_size().() 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().bytes.lenrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]len().(),
1731 }
1732 }
1733
1734 /// The exr name string of the type that an attribute can have.
1735 pub fn kind_namerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[AttributeValue]kind_name().(&self) -> &TextSlicerust-analyzer cargo exr 1.74.0 meta/attribute/TextSlice# {
1736 use selfrust-analyzer cargo exr 1.74.0 meta/attribute/::AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#::*;
1737 use selfrust-analyzer cargo exr 1.74.0 meta/attribute/::type_namesrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/ as tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/;
1738
1739 match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self {
1740 IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#IntegerBounds#(_) => tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::I32BOX2rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/I32BOX2.,
1741 FloatRectrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#FloatRect#(_) => tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::F32BOX2rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/F32BOX2.,
1742 I32rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#I32#(_) => tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::I32rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/I32.,
1743 F32rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#F32#(_) => tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::F32rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/F32.,
1744 F64rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#F64#(_) => tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::F64rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/F64.,
1745 Rationalrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Rational#(_) => tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::RATIONALrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/RATIONAL.,
1746 TimeCoderust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#TimeCode#(_) => tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::TIME_CODErust-analyzer cargo exr 1.74.0 meta/attribute/type_names/TIME_CODE.,
1747 IntVec2rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#IntVec2#(_) => tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::I32VEC2rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/I32VEC2.,
1748 FloatVec2rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#FloatVec2#(_) => tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::F32VEC2rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/F32VEC2.,
1749 IntVec3rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#IntVec3#(_) => tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::I32VEC3rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/I32VEC3.,
1750 FloatVec3rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#FloatVec3#(_) => tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::F32VEC3rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/F32VEC3.,
1751 ChannelListrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#ChannelList#(_) => tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::CHANNEL_LISTrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/CHANNEL_LIST.,
1752 Chromaticitiesrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Chromaticities#(_) => tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::CHROMATICITIESrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/CHROMATICITIES.,
1753 Compressionrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Compression#(_) => tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::COMPRESSIONrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/COMPRESSION.,
1754 EnvironmentMaprust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#EnvironmentMap#(_) => tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::ENVIRONMENT_MAPrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/ENVIRONMENT_MAP.,
1755 KeyCoderust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#KeyCode#(_) => tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::KEY_CODErust-analyzer cargo exr 1.74.0 meta/attribute/type_names/KEY_CODE.,
1756 LineOrderrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#LineOrder#(_) => tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::LINE_ORDERrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/LINE_ORDER.,
1757 Matrix3x3rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Matrix3x3#(_) => tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::F32MATRIX3X3rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/F32MATRIX3X3.,
1758 Matrix4x4rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Matrix4x4#(_) => tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::F32MATRIX4X4rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/F32MATRIX4X4.,
1759 Previewrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Preview#(_) => tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::PREVIEWrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/PREVIEW.,
1760 Textrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Text#(_) => tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::TEXTrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/TEXT.,
1761 TextVectorrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#TextVector#(_) => tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::TEXT_VECTORrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/TEXT_VECTOR.,
1762 TileDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#TileDescription#(_) => tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::TILESrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/TILES.,
1763 BlockTyperust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#BlockType#(_) => superrust-analyzer cargo exr 1.74.0 meta/::BlockTyperust-analyzer cargo exr 1.74.0 meta/attribute/BlockType#::TYPE_NAMErust-analyzer cargo exr 1.74.0 meta/attribute/impl#[BlockType]TYPE_NAME.,
1764 Bytesrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Bytes#{ .. } => tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::BYTESrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/BYTES.,
1765 Customrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Custom# { ref kindrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Custom#kind., .. } => kind.as_slicerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]as_slice().(),
1766 }
1767 }
1768
1769 /// Without validation, write this instance to the byte stream.
1770 pub fn writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[AttributeValue]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, write: &mut W) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
1771 use selfrust-analyzer cargo exr 1.74.0 meta/attribute/::AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#::*;
1772 match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self {
1773 IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#IntegerBounds#(value) => value.writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]write().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1774 FloatRectrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#FloatRect#(value) => value.writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[FloatRect]write().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1775
1776 I32rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#I32#(value) => value.write_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1777 F32rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#F32#(value) => value.write_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1778 F64rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#F64#(value) => value.write_lerust-analyzer cargo exr 1.74.0 io/impl#[f64][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1779
1780 Rationalrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Rational#((a, b)) => { a.write_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; b.write_lerust-analyzer cargo exr 1.74.0 io/impl#[u32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; },
1781 TimeCoderust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#TimeCode#(codes) => codes.writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]write().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1782
1783 IntVec2rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#IntVec2#(Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(x, y)) => { x.write_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; y.write_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; },
1784 FloatVec2rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#FloatVec2#(Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(x, y)) => { x.write_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; y.write_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; },
1785 IntVec3rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#IntVec3#((x, y, z)) => { x.write_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; y.write_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; z.write_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; },
1786 FloatVec3rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#FloatVec3#((x, y, z)) => { x.write_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; y.write_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; z.write_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]write_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; },
1787
1788 ChannelListrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#ChannelList#(ref channels) => channels.writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelList]write().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1789 Chromaticitiesrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Chromaticities#(ref value) => value.writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Chromaticities]write().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1790 Compressionrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Compression#(value) => value.writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Compression]write().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1791 EnvironmentMaprust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#EnvironmentMap#(value) => value.writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[EnvironmentMap]write().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1792
1793 KeyCoderust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#KeyCode#(value) => value.writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[KeyCode]write().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1794 LineOrderrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#LineOrder#(value) => value.writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[LineOrder]write().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1795
1796 Matrix3x3rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Matrix3x3#(mut value) => f32::write_slice_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]write_slice_le().(write, &mut value)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1797 Matrix4x4rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Matrix4x4#(mut value) => f32::write_slice_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]write_slice_le().(write, &mut value)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1798
1799 Previewrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Preview#(ref value) => value.writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Preview]write().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1800
1801 // attribute value texts never have limited size.
1802 // also, don't serialize size, as it can be inferred from attribute size
1803 Textrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Text#(ref value) => u8::write_slice_lerust-analyzer cargo exr 1.74.0 io/impl#[u8][Data]write_slice_le().(write, value.bytesrust-analyzer cargo exr 1.74.0 meta/attribute/Text#bytes..as_slicerust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]as_slice().())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1804
1805 TextVectorrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#TextVector#(ref value) => selfrust-analyzer cargo exr 1.74.0 meta/attribute/::Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::write_vec_of_i32_sized_texts_lerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]write_vec_of_i32_sized_texts_le().(write, value)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1806 TileDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#TileDescription#(ref value) => value.writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TileDescription]write().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1807 BlockTyperust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#BlockType#(kind) => kind.writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[BlockType]write().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1808
1809 Bytesrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Bytes# { ref type_hintrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Bytes#type_hint., ref bytesrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Bytes#bytes. } => {
1810 type_hint.write_u32_sized_lerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]write_u32_sized_le().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; // no idea why this one is u32, everything else is usually i32...
1811 u8::write_slice_lerust-analyzer cargo exr 1.74.0 io/impl#[u8][Data]write_slice_le().(write, bytes.as_slicerust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]as_slice().())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
1812 }
1813
1814 Customrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Custom# { ref bytesrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Custom#bytes., .. } => u8::write_slice_lerust-analyzer cargo exr 1.74.0 io/impl#[u8][Data]write_slice_le().(write, &bytes)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., // write.write(&bytes).map(|_| ()),
1815 };
1816
1817 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
1818 }
1819
1820 /// Read the value without validating.
1821 /// Returns `Ok(Ok(attribute))` for valid attributes.
1822 /// Returns `Ok(Err(Error))` for malformed attributes from a valid byte source.
1823 /// Returns `Err(Error)` for invalid byte sources, for example for invalid files.
1824 pub fn readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[AttributeValue]read().(read: &mut PeekReadrust-analyzer cargo exr 1.74.0 io/PeekRead#<impl Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#>, kind: Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#, byte_size: usize) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<Resultrust-analyzer cargo exr 1.74.0 error/Result#<Selfrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[AttributeValue]>> {
1825 use selfrust-analyzer cargo exr 1.74.0 meta/attribute/::AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#::*;
1826 use selfrust-analyzer cargo exr 1.74.0 meta/attribute/::type_namesrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/ as tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/;
1827
1828 // always read bytes as to leave the read position at the end of the attribute
1829 // even if the attribute contents fails to decode
1830 let mut attribute_bytes = SmallVecrust-analyzer cargo smallvec 1.15.1 SmallVec#::<[u8; 64]>::newrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]new().();
1831 u8::read_into_vec_lerust-analyzer cargo exr 1.74.0 io/Data#read_into_vec_le().(read, &mut attribute_bytes, byte_size, 64, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, "attribute value size")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1832 // TODO: don't read into an array at all, just read directly from the reader and optionally seek afterwards?
1833
1834 let parse_attribute = move || {
1835 let reader = &mut attribute_bytes.as_slicerust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]as_slice().();
1836
1837 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(match kind.bytesrust-analyzer cargo exr 1.74.0 meta/attribute/Text#bytes..as_slicerust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]as_slice().() {
1838 tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::I32BOX2rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/I32BOX2. => IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#IntegerBounds#(selfrust-analyzer cargo exr 1.74.0 meta/attribute/::IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#::readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]read().(reader)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().),
1839 tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::F32BOX2rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/F32BOX2. => FloatRectrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#FloatRect#(selfrust-analyzer cargo exr 1.74.0 meta/attribute/::FloatRectrust-analyzer cargo exr 1.74.0 meta/attribute/FloatRect#::readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[FloatRect]read().(reader)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().),
1840
1841 tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::I32rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/I32. => I32rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#I32#(i32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]read_le().(reader)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().),
1842 tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::F32rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/F32. => F32rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#F32#(f32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]read_le().(reader)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().),
1843 tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::F64rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/F64. => F64rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#F64#(f64::read_lerust-analyzer cargo exr 1.74.0 io/impl#[f64][Data]read_le().(reader)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().),
1844
1845 tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::RATIONALrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/RATIONAL. => Rationalrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Rational#({
1846 let a = i32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]read_le().(reader)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1847 let b = u32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[u32][Data]read_le().(reader)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1848 (a, b)
1849 }),
1850
1851 tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::TIME_CODErust-analyzer cargo exr 1.74.0 meta/attribute/type_names/TIME_CODE. => TimeCoderust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#TimeCode#(selfrust-analyzer cargo exr 1.74.0 meta/attribute/::TimeCoderust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#::readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]read().(reader)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().),
1852
1853 tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::I32VEC2rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/I32VEC2. => IntVec2rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#IntVec2#({
1854 let a = i32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]read_le().(reader)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1855 let b = i32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]read_le().(reader)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1856 Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(a, b)
1857 }),
1858
1859 tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::F32VEC2rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/F32VEC2. => FloatVec2rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#FloatVec2#({
1860 let a = f32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]read_le().(reader)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1861 let b = f32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]read_le().(reader)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1862 Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(a, b)
1863 }),
1864
1865 tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::I32VEC3rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/I32VEC3. => IntVec3rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#IntVec3#({
1866 let a = i32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]read_le().(reader)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1867 let b = i32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]read_le().(reader)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1868 let c = i32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[i32][Data]read_le().(reader)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1869 (a, b, c)
1870 }),
1871
1872 tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::F32VEC3rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/F32VEC3. => FloatVec3rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#FloatVec3#({
1873 let a = f32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]read_le().(reader)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1874 let b = f32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]read_le().(reader)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1875 let c = f32::read_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]read_le().(reader)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1876 (a, b, c)
1877 }),
1878
1879 tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::CHANNEL_LISTrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/CHANNEL_LIST. => ChannelListrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#ChannelList#(selfrust-analyzer cargo exr 1.74.0 meta/attribute/::ChannelListrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelList#::readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelList]read().(&mut PeekReadrust-analyzer cargo exr 1.74.0 io/PeekRead#::newrust-analyzer cargo exr 1.74.0 io/impl#[`PeekRead<T>`]new().(attribute_bytes.as_slicerust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]as_slice().()))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().),
1880 tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::CHROMATICITIESrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/CHROMATICITIES. => Chromaticitiesrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Chromaticities#(selfrust-analyzer cargo exr 1.74.0 meta/attribute/::Chromaticitiesrust-analyzer cargo exr 1.74.0 meta/attribute/Chromaticities#::readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Chromaticities]read().(reader)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().),
1881 tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::COMPRESSIONrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/COMPRESSION. => Compressionrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Compression#(selfrust-analyzer cargo exr 1.74.0 meta/attribute/::Compressionrust-analyzer cargo exr 1.74.0 compression/Compression#::readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Compression]read().(reader)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().),
1882 tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::ENVIRONMENT_MAPrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/ENVIRONMENT_MAP. => EnvironmentMaprust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#EnvironmentMap#(selfrust-analyzer cargo exr 1.74.0 meta/attribute/::EnvironmentMaprust-analyzer cargo exr 1.74.0 meta/attribute/EnvironmentMap#::readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[EnvironmentMap]read().(reader)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().),
1883
1884 tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::KEY_CODErust-analyzer cargo exr 1.74.0 meta/attribute/type_names/KEY_CODE. => KeyCoderust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#KeyCode#(selfrust-analyzer cargo exr 1.74.0 meta/attribute/::KeyCoderust-analyzer cargo exr 1.74.0 meta/attribute/KeyCode#::readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[KeyCode]read().(reader)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().),
1885 tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::LINE_ORDERrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/LINE_ORDER. => LineOrderrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#LineOrder#(selfrust-analyzer cargo exr 1.74.0 meta/attribute/::LineOrderrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#::readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[LineOrder]read().(reader)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().),
1886
1887 tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::F32MATRIX3X3rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/F32MATRIX3X3. => Matrix3x3rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Matrix3x3#({
1888 let mut result = [0.0_f32; 9];
1889 f32::read_slice_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]read_slice_le().(reader, &mut result)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1890 result
1891 }),
1892
1893 tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::F32MATRIX4X4rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/F32MATRIX4X4. => Matrix4x4rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Matrix4x4#({
1894 let mut result = [0.0_f32; 16];
1895 f32::read_slice_lerust-analyzer cargo exr 1.74.0 io/impl#[f32][Data]read_slice_le().(reader, &mut result)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1896 result
1897 }),
1898
1899 tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::PREVIEWrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/PREVIEW. => Previewrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Preview#(selfrust-analyzer cargo exr 1.74.0 meta/attribute/::Previewrust-analyzer cargo exr 1.74.0 meta/attribute/Preview#::readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Preview]read().(reader)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().),
1900 tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::TEXTrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/TEXT. => Textrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Text#(selfrust-analyzer cargo exr 1.74.0 meta/attribute/::Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::read_sizedrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]read_sized().(reader, byte_size)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().),
1901
1902 // the number of strings can be inferred from the total attribute size
1903 tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::TEXT_VECTORrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/TEXT_VECTOR. => TextVectorrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#TextVector#(selfrust-analyzer cargo exr 1.74.0 meta/attribute/::Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::read_vec_of_i32_sized_texts_lerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]read_vec_of_i32_sized_texts_le().(
1904 &mut PeekReadrust-analyzer cargo exr 1.74.0 io/PeekRead#::newrust-analyzer cargo exr 1.74.0 io/impl#[`PeekRead<T>`]new().(attribute_bytes.as_slicerust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]as_slice().()),
1905 byte_size
1906 )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().),
1907
1908 tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::TILESrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/TILES. => TileDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#TileDescription#(selfrust-analyzer cargo exr 1.74.0 meta/attribute/::TileDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription#::readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TileDescription]read().(reader)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().),
1909
1910 tyrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/::BYTESrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/BYTES. => {
1911 // for some reason, they went for unsigned sizes, in this place only
1912 let type_hint = selfrust-analyzer cargo exr 1.74.0 meta/attribute/::Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::read_u32_sized_lerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]read_u32_sized_le().(reader, reader.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1913 let bytes = SmallVecrust-analyzer cargo smallvec 1.15.1 SmallVec#::fromrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`][`From<&'a [<A as Array>::Item]>`]from().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().reader);
1914 Bytesrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Bytes# { type_hintrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Bytes#type_hint., bytesrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Bytes#bytes. }
1915 }
1916
1917 _ => Customrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Custom# { kindrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Custom#kind.: kind.clonerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][Clone]clone().(), bytesrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Custom#bytes.: SmallVecrust-analyzer cargo smallvec 1.15.1 SmallVec#::fromrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`][`From<&'a [<A as Array>::Item]>`]from().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().reader) }
1918 })
1919 };
1920
1921 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(parse_attribute())
1922 }
1923
1924 /// Validate this instance.
1925 pub fn validaterust-analyzer cargo exr 1.74.0 meta/attribute/impl#[AttributeValue]validate().(&self, allow_sampling: bool, data_window: IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#, strict: bool) -> UnitResultrust-analyzer cargo exr 1.74.0 error/UnitResult# {
1926 use selfrust-analyzer cargo exr 1.74.0 meta/attribute/::AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#::*;
1927
1928 match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self {
1929 ChannelListrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#ChannelList#(ref channels) => channels.validaterust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelList]validate().(allow_sampling, data_window, strict)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1930 TileDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#TileDescription#(ref value) => value.validaterust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TileDescription]validate().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1931 Previewrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Preview#(ref value) => value.validaterust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Preview]validate().(strict)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1932 TimeCoderust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#TimeCode#(ref time_code) => time_code.validaterust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]validate().(strict)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1933
1934 TextVectorrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#TextVector#(ref vec) => if strict && vec.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() {
1935 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::invalidrust-analyzer cargo exr 1.74.0 error/impl#[Error]invalid().("text vector may not be empty"))
1936 },
1937
1938 _ => {}
1939 };
1940
1941 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
1942 }
1943
1944
1945 /// Return `Ok(i32)` if this attribute is an i32.
1946 pub fn to_i32rust-analyzer cargo exr 1.74.0 meta/attribute/impl#[AttributeValue]to_i32().(&self) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<i32> {
1947 match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self {
1948 AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#::I32rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#I32#(value) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(value),
1949 _ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(invalid_typerust-analyzer cargo exr 1.74.0 meta/attribute/invalid_type().())
1950 }
1951 }
1952
1953 /// Return `Ok(f32)` if this attribute is an f32.
1954 pub fn to_f32rust-analyzer cargo exr 1.74.0 meta/attribute/impl#[AttributeValue]to_f32().(&self) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<f32> {
1955 match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self {
1956 AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#::F32rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#F32#(value) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(value),
1957 _ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(invalid_typerust-analyzer cargo exr 1.74.0 meta/attribute/invalid_type().())
1958 }
1959 }
1960
1961 /// Return `Ok(Text)` if this attribute is a text.
1962 pub fn into_textrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[AttributeValue]into_text().(self) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#> {
1963 match self {
1964 AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#::Textrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Text#(value) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(value),
1965 _ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(invalid_typerust-analyzer cargo exr 1.74.0 meta/attribute/invalid_type().())
1966 }
1967 }
1968
1969 /// Return `Ok(Text)` if this attribute is a text.
1970 pub fn to_textrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[AttributeValue]to_text().(&self) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<&Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#> {
1971 match self {
1972 AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#::Textrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Text#(value) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(value),
1973 _ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(invalid_typerust-analyzer cargo exr 1.74.0 meta/attribute/invalid_type().())
1974 }
1975 }
1976
1977 /// Return `Ok(Chromaticities)` if this attribute is a chromaticities attribute.
1978 pub fn to_chromaticitiesrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[AttributeValue]to_chromaticities().(&self) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<Chromaticitiesrust-analyzer cargo exr 1.74.0 meta/attribute/Chromaticities#> {
1979 match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self {
1980 AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#::Chromaticitiesrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Chromaticities#(value) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(value),
1981 _ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(invalid_typerust-analyzer cargo exr 1.74.0 meta/attribute/invalid_type().())
1982 }
1983 }
1984
1985 /// Return `Ok(TimeCode)` if this attribute is a time code.
1986 pub fn to_time_coderust-analyzer cargo exr 1.74.0 meta/attribute/impl#[AttributeValue]to_time_code().(&self) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<TimeCoderust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#> {
1987 match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self {
1988 AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#::TimeCoderust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#TimeCode#(value) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(value),
1989 _ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(invalid_typerust-analyzer cargo exr 1.74.0 meta/attribute/invalid_type().())
1990 }
1991 }
1992 }
1993
1994
1995
1996 /// Contains string literals identifying the type of an attribute.
1997 pub mod type_namesrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/ {
1998 macro_rules! define_attribute_type_namesrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/define_attribute_type_names! {
1999 ( $($name: ident : $value: expr),* ) => {
2000 $(
2001 /// The byte-string name of this attribute type as it appears in an exr file.
2002 pub const $name: &'static [u8] = $value;
2003 )*
2004 };
2005 }
2006
2007 define_attribute_type_namesrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/define_attribute_type_names!! {
2008 I32BOX2rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/I32BOX2.: b"box2i",
2009 F32BOX2rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/F32BOX2.: b"box2f",
2010 I32rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/I32.: b"int",
2011 F32rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/F32.: b"float",
2012 F64rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/F64.: b"double",
2013 RATIONALrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/RATIONAL.: b"rational",
2014 TIME_CODErust-analyzer cargo exr 1.74.0 meta/attribute/type_names/TIME_CODE.: b"timecode",
2015 I32VEC2rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/I32VEC2.: b"v2i",
2016 F32VEC2rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/F32VEC2.: b"v2f",
2017 I32VEC3rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/I32VEC3.: b"v3i",
2018 F32VEC3rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/F32VEC3.: b"v3f",
2019 CHANNEL_LISTrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/CHANNEL_LIST.: b"chlist",
2020 CHROMATICITIESrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/CHROMATICITIES.: b"chromaticities",
2021 COMPRESSIONrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/COMPRESSION.: b"compression",
2022 ENVIRONMENT_MAPrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/ENVIRONMENT_MAP.:b"envmap",
2023 KEY_CODErust-analyzer cargo exr 1.74.0 meta/attribute/type_names/KEY_CODE.: b"keycode",
2024 LINE_ORDERrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/LINE_ORDER.: b"lineOrder",
2025 F32MATRIX3X3rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/F32MATRIX3X3.: b"m33f",
2026 F32MATRIX4X4rust-analyzer cargo exr 1.74.0 meta/attribute/type_names/F32MATRIX4X4.: b"m44f",
2027 PREVIEWrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/PREVIEW.: b"preview",
2028 TEXTrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/TEXT.: b"string",
2029 TEXT_VECTORrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/TEXT_VECTOR.: b"stringvector",
2030 TILESrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/TILES.: b"tiledesc",
2031 BYTESrust-analyzer cargo exr 1.74.0 meta/attribute/type_names/BYTES.: b"bytes"
2032 }
2033 }
2034
2035
2036 #[cfg(test)]
2037 mod testrust-analyzer cargo exr 1.74.0 meta/attribute/test/ {
2038 use superrust-analyzer cargo exr 1.74.0 meta/attribute/::*;
2039 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#;
2040 use randrust-analyzer cargo rand 0.8.5 crate/::{randomrust-analyzer cargo rand 0.8.5 random()., thread_rngrust-analyzer cargo rand 0.8.5 rngs/thread/thread_rng()., Rngrust-analyzer cargo rand 0.8.5 rng/Rng#};
2041
2042 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
2043 fn text_ordrust-analyzer cargo exr 1.74.0 meta/attribute/test/text_ord().() {
2044 for _ in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#1024 {
2045 let text1 = Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::from_bytes_uncheckedrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]from_bytes_unchecked().((0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#4).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|_| randrust-analyzer cargo rand 0.8.5 crate/::randomrust-analyzer cargo rand 0.8.5 random().::<u8>()).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().());
2046 let text2 = Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::from_bytes_uncheckedrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]from_bytes_unchecked().((0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#4).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|_| randrust-analyzer cargo rand 0.8.5 crate/::randomrust-analyzer cargo rand 0.8.5 random().::<u8>()).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().());
2047
2048 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(text1.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().().cmprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Ord]cmp().(&text2.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), text1.cmprust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][Ord]cmp().(&text2), "in text {:?} vs {:?}", text1, text2);
2049 }
2050 }
2051
2052 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
2053 fn rounding_uprust-analyzer cargo exr 1.74.0 meta/attribute/test/rounding_up().(){
2054 let round_up = RoundingModerust-analyzer cargo exr 1.74.0 math/RoundingMode#::Uprust-analyzer cargo exr 1.74.0 math/RoundingMode#Up#;
2055 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(round_up.dividerust-analyzer cargo exr 1.74.0 math/impl#[RoundingMode]divide().(10, 10), 1, "divide equal");
2056 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(round_up.dividerust-analyzer cargo exr 1.74.0 math/impl#[RoundingMode]divide().(10, 2), 5, "divide even");
2057 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(round_up.dividerust-analyzer cargo exr 1.74.0 math/impl#[RoundingMode]divide().(10, 5), 2, "divide even");
2058
2059 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(round_up.dividerust-analyzer cargo exr 1.74.0 math/impl#[RoundingMode]divide().(8, 5), 2, "round up");
2060 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(round_up.dividerust-analyzer cargo exr 1.74.0 math/impl#[RoundingMode]divide().(10, 3), 4, "round up");
2061 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(round_up.dividerust-analyzer cargo exr 1.74.0 math/impl#[RoundingMode]divide().(100, 50), 2, "divide even");
2062 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(round_up.dividerust-analyzer cargo exr 1.74.0 math/impl#[RoundingMode]divide().(100, 49), 3, "round up");
2063 }
2064
2065 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
2066 fn rounding_downrust-analyzer cargo exr 1.74.0 meta/attribute/test/rounding_down().(){
2067 let round_down = RoundingModerust-analyzer cargo exr 1.74.0 math/RoundingMode#::Downrust-analyzer cargo exr 1.74.0 math/RoundingMode#Down#;
2068 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(round_down.dividerust-analyzer cargo exr 1.74.0 math/impl#[RoundingMode]divide().(8, 5), 1, "round down");
2069 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(round_down.dividerust-analyzer cargo exr 1.74.0 math/impl#[RoundingMode]divide().(10, 3), 3, "round down");
2070 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(round_down.dividerust-analyzer cargo exr 1.74.0 math/impl#[RoundingMode]divide().(100, 50), 2, "divide even");
2071 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(round_down.dividerust-analyzer cargo exr 1.74.0 math/impl#[RoundingMode]divide().(100, 49), 2, "round down");
2072 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(round_down.dividerust-analyzer cargo exr 1.74.0 math/impl#[RoundingMode]divide().(100, 51), 1, "round down");
2073 }
2074
2075 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
2076 fn tile_description_write_read_roundtriprust-analyzer cargo exr 1.74.0 meta/attribute/test/tile_description_write_read_roundtrip().(){
2077 let tiles = [
2078 TileDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription# {
2079 tile_sizerust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription#tile_size.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(31, 7),
2080 level_moderust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription#level_mode.: LevelModerust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#::MipMaprust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#MipMap#,
2081 rounding_moderust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription#rounding_mode.: RoundingModerust-analyzer cargo exr 1.74.0 math/RoundingMode#::Downrust-analyzer cargo exr 1.74.0 math/RoundingMode#Down#,
2082 },
2083
2084 TileDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription# {
2085 tile_sizerust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription#tile_size.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(0, 0),
2086 level_moderust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription#level_mode.: LevelModerust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#::Singularrust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#Singular#,
2087 rounding_moderust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription#rounding_mode.: RoundingModerust-analyzer cargo exr 1.74.0 math/RoundingMode#::Uprust-analyzer cargo exr 1.74.0 math/RoundingMode#Up#,
2088 },
2089
2090 TileDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription# {
2091 tile_sizerust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription#tile_size.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(4294967294, 4294967295),
2092 level_moderust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription#level_mode.: LevelModerust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#::RipMaprust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#RipMap#,
2093 rounding_moderust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription#rounding_mode.: RoundingModerust-analyzer cargo exr 1.74.0 math/RoundingMode#::Downrust-analyzer cargo exr 1.74.0 math/RoundingMode#Down#,
2094 },
2095 ];
2096
2097 for tile in &tiles {
2098 let mut bytes = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().();
2099 tile.writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TileDescription]write().(&mut bytes).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
2100
2101 let new_tile = TileDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/TileDescription#::readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TileDescription]read().(&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().(bytes)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
2102 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().tile, new_tile, "tile round trip");
2103 }
2104 }
2105
2106 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
2107 fn attribute_write_read_roundtrip_and_byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/test/attribute_write_read_roundtrip_and_byte_size().(){
2108 let attributes = [
2109 (
2110 Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::fromrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`From<&'s str>`]from().("greeting"),
2111 AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#::Textrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Text#(Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::fromrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`From<&'s str>`]from().("hello")),
2112 ),
2113 (
2114 Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::fromrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`From<&'s str>`]from().("age"),
2115 AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#::I32rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#I32#(923),
2116 ),
2117 (
2118 Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::fromrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`From<&'s str>`]from().("leg count"),
2119 AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#::F64rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#F64#(9.114939599234),
2120 ),
2121 (
2122 Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::fromrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`From<&'s str>`]from().("rabbit area"),
2123 AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#::FloatRectrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#FloatRect#(FloatRectrust-analyzer cargo exr 1.74.0 meta/attribute/FloatRect# {
2124 minrust-analyzer cargo exr 1.74.0 meta/attribute/FloatRect#min.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(23.4234, 345.23),
2125 maxrust-analyzer cargo exr 1.74.0 meta/attribute/FloatRect#max.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(68623.0, 3.12425926538),
2126 }),
2127 ),
2128 (
2129 Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::fromrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`From<&'s str>`]from().("rabbit area int"),
2130 AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#::IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#IntegerBounds#(IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds# {
2131 positionrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#position.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(23, 345),
2132 sizerust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#size.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(68623, 3),
2133 }),
2134 ),
2135 (
2136 Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::fromrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`From<&'s str>`]from().("rabbit area int"),
2137 AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#::IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#IntegerBounds#(IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds# {
2138 positionrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#position.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().(i32::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]MAX. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Div<Self>`]div().2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().1), -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().(i32::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]MAX. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Div<Self>`]div().2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().1)),
2139 sizerust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#size.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(i32::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]MAX. as usize rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().2, i32::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]MAX. as usize rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().2),
2140 }),
2141 ),
2142 (
2143 Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::fromrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`From<&'s str>`]from().("rabbit area int 2"),
2144 AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#::IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#IntegerBounds#(IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds# {
2145 positionrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#position.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(0, 0),
2146 sizerust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#size.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(i32::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]MAX. as usize rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().1, i32::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]MAX. as usize rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().1),
2147 }),
2148 ),
2149 (
2150 Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::fromrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`From<&'s str>`]from().("tests are difficult"),
2151 AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#::TextVectorrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#TextVector#(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
2152 Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::fromrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`From<&'s str>`]from().("sdoifjpsdv"),
2153 Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::fromrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`From<&'s str>`]from().("sdoifjpsdvxxxx"),
2154 Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::fromrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`From<&'s str>`]from().("sdoifjasd"),
2155 Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::fromrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`From<&'s str>`]from().("sdoifj"),
2156 Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::fromrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`From<&'s str>`]from().("sdoifjddddddddasdasd"),
2157 ]),
2158 ),
2159 (
2160 Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::fromrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`From<&'s str>`]from().("what should we eat tonight"),
2161 AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#::Previewrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Preview#(Previewrust-analyzer cargo exr 1.74.0 meta/attribute/Preview# {
2162 sizerust-analyzer cargo exr 1.74.0 meta/attribute/Preview#size.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(10, 30),
2163 pixel_datarust-analyzer cargo exr 1.74.0 meta/attribute/Preview#pixel_data.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![31; 10 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 30 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 4],
2164 }),
2165 ),
2166 (
2167 Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::fromrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`From<&'s str>`]from().("custom byte sequence: prime numbers single byte"),
2168 AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#::Bytesrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Bytes#{
2169 type_hintrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Bytes#type_hint.: Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::fromrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`From<&'s str>`]from().("byte-primes"),
2170 bytesrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#Bytes#bytes.: smallvecrust-analyzer cargo smallvec 1.15.1 smallvec!![2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73],
2171 },
2172 ),
2173 (
2174 Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::fromrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`From<&'s str>`]from().("leg count, again"),
2175 AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#::ChannelListrust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#ChannelList#(ChannelListrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelList#::newrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelList]new().(smallvecrust-analyzer cargo smallvec 1.15.1 smallvec!![
2176 ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription# {
2177 namerust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#name.: Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::fromrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`From<&'s str>`]from().("Green"),
2178 sample_typerust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sample_type.: SampleTyperust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#::F16rust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#F16#,
2179 quantize_linearlyrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#quantize_linearly.: false,
2180 samplingrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sampling.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(1,2)
2181 },
2182 ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription# {
2183 namerust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#name.: Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::fromrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`From<&'s str>`]from().("Red"),
2184 sample_typerust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sample_type.: SampleTyperust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#::F32rust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#F32#,
2185 quantize_linearlyrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#quantize_linearly.: true,
2186 samplingrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sampling.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(1,2)
2187 },
2188 ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription# {
2189 namerust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#name.: Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::fromrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`From<&'s str>`]from().("Purple"),
2190 sample_typerust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sample_type.: SampleTyperust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#::U32rust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#U32#,
2191 quantize_linearlyrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#quantize_linearly.: false,
2192 samplingrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#sampling.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(0,0)
2193 }
2194 ],
2195 )),
2196 ),
2197 ];
2198
2199 for (name, value) in &attributes {
2200 let mut bytes = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().();
2201 superrust-analyzer cargo exr 1.74.0 meta/attribute/::writerust-analyzer cargo exr 1.74.0 meta/attribute/write().(name.as_slicerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text]as_slice().(), value, &mut bytes).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
2202 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(superrust-analyzer cargo exr 1.74.0 meta/attribute/::byte_sizerust-analyzer cargo exr 1.74.0 meta/attribute/byte_size().(name, value), bytes.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), "attribute.byte_size() for {:?}", (name, value));
2203
2204 let new_attribute = superrust-analyzer cargo exr 1.74.0 meta/attribute/::readrust-analyzer cargo exr 1.74.0 meta/attribute/read().(&mut PeekReadrust-analyzer cargo exr 1.74.0 io/PeekRead#::newrust-analyzer cargo exr 1.74.0 io/impl#[`PeekRead<T>`]new().(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().(bytes)), 300).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
2205 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!((name.clonerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][Clone]clone().(), value.clonerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[AttributeValue][Clone]clone().()), (new_attribute.0, new_attribute.1.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()), "attribute round trip");
2206 }
2207
2208
2209 {
2210 let (name, value) = (
2211 Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::fromrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`From<&'s str>`]from().("asdkaspfokpaosdkfpaokswdpoakpsfokaposdkf"),
2212 AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#::I32rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#I32#(0),
2213 );
2214
2215 let mut long_names = false;
2216 superrust-analyzer cargo exr 1.74.0 meta/attribute/::validaterust-analyzer cargo exr 1.74.0 meta/attribute/validate().(&name, &value, &mut long_names, false, IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#::zerorust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]zero().(), false).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
2217 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(long_names);
2218 }
2219
2220 {
2221 let (name, value) = (
2222 Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#::fromrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][`From<&'s str>`]from().("sdöksadöofkaspdolkpöasolfkcöalsod,kfcöaslodkcpöasolkfposdöksadöofkaspdolkpöasolfkcöalsod,kfcöaslodkcpöasolkfposdöksadöofkaspdolkpöasolfkcöalsod,kfcöaslodkcpöasolkfposdöksadöofkaspdolkpöasolfkcöalsod,kfcöaslodkcpöasolkfposdöksadöofkaspdolkpöasolfkcöalsod,kfcöaslodkcpöasolkfposdöksadöofkaspdolkpöasolfkcöalsod,kfcöaslodkcpöasolkfpo"),
2223 AttributeValuerust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#::I32rust-analyzer cargo exr 1.74.0 meta/attribute/AttributeValue#I32#(0),
2224 );
2225
2226 superrust-analyzer cargo exr 1.74.0 meta/attribute/::validaterust-analyzer cargo exr 1.74.0 meta/attribute/validate().(&name, &value, &mut false, false, IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#::zerorust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]zero().(), false).expect_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect_err().("name length check failed");
2227 }
2228 }
2229
2230 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
2231 fn time_code_packrust-analyzer cargo exr 1.74.0 meta/attribute/test/time_code_pack().(){
2232 let mut rng = thread_rngrust-analyzer cargo rand 0.8.5 rngs/thread/thread_rng().();
2233
2234 let codes = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::repeat_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/repeat_with/repeat_with().(|| TimeCoderust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode# {
2235 hoursrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#hours.: rng.gen_rangerust-analyzer cargo rand 0.8.5 rng/Rng#gen_range().(0 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#24),
2236 minutesrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#minutes.: rng.gen_rangerust-analyzer cargo rand 0.8.5 rng/Rng#gen_range().(0 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#60),
2237 secondsrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#seconds.: rng.gen_rangerust-analyzer cargo rand 0.8.5 rng/Rng#gen_range().(0 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#60),
2238 framerust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#frame.: rng.gen_rangerust-analyzer cargo rand 0.8.5 rng/Rng#gen_range().(0 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#29),
2239 drop_framerust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#drop_frame.: randomrust-analyzer cargo rand 0.8.5 random().(),
2240 color_framerust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#color_frame.: randomrust-analyzer cargo rand 0.8.5 random().(),
2241 field_phaserust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#field_phase.: randomrust-analyzer cargo rand 0.8.5 random().(),
2242 binary_group_flagsrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#binary_group_flags.: [randomrust-analyzer cargo rand 0.8.5 random().(),randomrust-analyzer cargo rand 0.8.5 random().(),randomrust-analyzer cargo rand 0.8.5 random().()],
2243 binary_groupsrust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#binary_groups.: stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::repeat_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/repeat_with/repeat_with().(|| rng.gen_rangerust-analyzer cargo rand 0.8.5 rng/Rng#gen_range().(0 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#16)).takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#take().(8)
2244 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<SmallVecrust-analyzer cargo smallvec 1.15.1 SmallVec#<[u8;8]>>().into_innerrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]into_inner().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
2245 });
2246
2247 for code in codes.takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#take().(500) {
2248 code.validaterust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]validate().(true).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("invalid timecode test input");
2249
2250 { // through tv60 packing, roundtrip
2251 let packed_tv60 = code.pack_time_as_tv60_u32rust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]pack_time_as_tv60_u32().().expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("invalid timecode test input");
2252 let packed_user = code.pack_user_data_as_u32rust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]pack_user_data_as_u32().();
2253 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(TimeCoderust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#::from_tv60_timerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]from_tv60_time().(packed_tv60, packed_user), code);
2254 }
2255
2256 { // through bytes, roundtrip
2257 let mut bytes = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::<u8>::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().();
2258 code.writerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]write().(&mut bytes).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
2259 let decoded = TimeCoderust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#::readrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]read().(&mut bytes.as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
2260 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(code, decoded);
2261 }
2262
2263 {
2264 let tv50_code = TimeCoderust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode# {
2265 drop_framerust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#drop_frame.: false, // apparently, tv50 does not support drop frame, so do not use this value
2266 .. code
2267 };
2268
2269 let packed_tv50 = code.pack_time_as_tv50_u32rust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]pack_time_as_tv50_u32().().expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("invalid timecode test input");
2270 let packed_user = code.pack_user_data_as_u32rust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]pack_user_data_as_u32().();
2271 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(TimeCoderust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#::from_tv50_timerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]from_tv50_time().(packed_tv50, packed_user), tv50_code);
2272 }
2273
2274 {
2275 let film24_code = TimeCoderust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode# {
2276 // apparently, film24 does not support some flags, so do not use those values
2277 color_framerust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#color_frame.: false,
2278 drop_framerust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#drop_frame.: false,
2279 .. code
2280 };
2281
2282 let packed_film24 = code.pack_time_as_film24_u32rust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]pack_time_as_film24_u32().().expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("invalid timecode test input");
2283 let packed_user = code.pack_user_data_as_u32rust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]pack_user_data_as_u32().();
2284 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(TimeCoderust-analyzer cargo exr 1.74.0 meta/attribute/TimeCode#::from_film24_timerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[TimeCode]from_film24_time().(packed_film24, packed_user), film24_code);
2285 }
2286 }
2287 }
2288
2289 }