| 1 |
|
| 2 |
//! Data structures that represent a complete exr image. |
| 3 |
//! Contains generic structs that must be nested to obtain a complete image type. |
| 4 |
//! |
| 5 |
//! |
| 6 |
//! For example, an rgba image containing multiple layers |
| 7 |
//! can be represented using `Image<Layers<SpecificChannels<MyPixelStorage>>>`. |
| 8 |
//! An image containing a single layer with arbitrary channels and no deep data |
| 9 |
//! can be represented using `Image<Layer<AnyChannels<FlatSamples>>>`. |
| 10 |
//! |
| 11 |
//! |
| 12 |
//! These and other predefined types are included in this module as |
| 13 |
//! 1. `PixelImage`: A single layer, fixed set of arbitrary channels. |
| 14 |
//! 1. `PixelLayersImage`: Multiple layers, fixed set of arbitrary channels. |
| 15 |
//! 1. `RgbaImage`: A single layer, fixed set of channels: rgb, optional a. |
| 16 |
//! 1. `RgbaLayersImage`: Multiple layers, fixed set of channels: rgb, optional a. |
| 17 |
//! 1. `FlatImage`: Multiple layers, any channels, no deep data. |
| 18 |
//! 1. `AnyImage`: All supported data (multiple layers, arbitrary channels, no deep data yet) |
| 19 |
//! |
| 20 |
//! You can also use your own types inside an image, |
| 21 |
//! for example if you want to use a custom sample storage. |
| 22 |
//! |
| 23 |
//! This is the high-level interface for the pixels of an image. |
| 24 |
//! See `exr::blocks` module for a low-level interface. |
| 25 |
|
| 26 |
pub mod readrust-analyzer cargo exr 1.74.0 image/read/; |
| 27 |
pub mod writerust-analyzer cargo exr 1.74.0 image/write/; |
| 28 |
pub mod croprust-analyzer cargo exr 1.74.0 image/crop/; |
| 29 |
pub mod pixel_vecrust-analyzer cargo exr 1.74.0 image/pixel_vec/; |
| 30 |
pub mod recursiverust-analyzer cargo exr 1.74.0 image/recursive/; |
| 31 |
// pub mod channel_groups; |
| 32 |
|
| 33 |
|
| 34 |
use craterust-analyzer cargo exr 1.74.0 crate/::metarust-analyzer cargo exr 1.74.0 meta/::headerrust-analyzer cargo exr 1.74.0 meta/header/::{ImageAttributesrust-analyzer cargo exr 1.74.0 meta/header/ImageAttributes#, LayerAttributesrust-analyzer cargo exr 1.74.0 meta/header/LayerAttributes#}; |
| 35 |
use craterust-analyzer cargo exr 1.74.0 crate/::metarust-analyzer cargo exr 1.74.0 meta/::attributerust-analyzer cargo exr 1.74.0 meta/attribute/::{Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#, LineOrderrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#}; |
| 36 |
use halfrust-analyzer cargo half 2.6.0 crate/::f16rust-analyzer cargo half 2.6.0 binary16/f16#; |
| 37 |
use craterust-analyzer cargo exr 1.74.0 crate/::mathrust-analyzer cargo exr 1.74.0 math/::{Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#, RoundingModerust-analyzer cargo exr 1.74.0 math/RoundingMode#}; |
| 38 |
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#; |
| 39 |
use smallvecrust-analyzer cargo smallvec 1.15.1 crate/::{SmallVecrust-analyzer cargo smallvec 1.15.1 SmallVec#}; |
| 40 |
use craterust-analyzer cargo exr 1.74.0 crate/::errorrust-analyzer cargo exr 1.74.0 error/::Errorrust-analyzer cargo exr 1.74.0 error/Error#; |
| 41 |
|
| 42 |
/// Don't do anything |
| 43 |
pub(craterust-analyzer cargo exr 1.74.0 crate/) fn ignore_progressrust-analyzer cargo exr 1.74.0 image/ignore_progress().(_progress: f64){} |
| 44 |
|
| 45 |
/// This image type contains all supported exr features and can represent almost any image. |
| 46 |
/// It currently does not support deep data yet. |
| 47 |
pub type AnyImagerust-analyzer cargo exr 1.74.0 image/AnyImage# = Imagerust-analyzer cargo exr 1.74.0 image/Image#<Layersrust-analyzer cargo exr 1.74.0 image/Layers#<AnyChannelsrust-analyzer cargo exr 1.74.0 image/AnyChannels#<Levelsrust-analyzer cargo exr 1.74.0 image/Levels#<FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#>>>>; |
| 48 |
|
| 49 |
/// This image type contains the most common exr features and can represent almost any plain image. |
| 50 |
/// Does not contain resolution levels. Does not support deep data. |
| 51 |
pub type FlatImagerust-analyzer cargo exr 1.74.0 image/FlatImage# = Imagerust-analyzer cargo exr 1.74.0 image/Image#<Layersrust-analyzer cargo exr 1.74.0 image/Layers#<AnyChannelsrust-analyzer cargo exr 1.74.0 image/AnyChannels#<FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#>>>; |
| 52 |
|
| 53 |
/// This image type contains multiple layers, with each layer containing a user-defined type of pixels. |
| 54 |
pub type PixelLayersImagerust-analyzer cargo exr 1.74.0 image/PixelLayersImage#<Storage, Channels> = Imagerust-analyzer cargo exr 1.74.0 image/Image#<Layersrust-analyzer cargo exr 1.74.0 image/Layers#<SpecificChannelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#<Storage, Channels>>>; |
| 55 |
|
| 56 |
/// This image type contains a single layer containing a user-defined type of pixels. |
| 57 |
pub type PixelImagerust-analyzer cargo exr 1.74.0 image/PixelImage#<Storage, Channels> = Imagerust-analyzer cargo exr 1.74.0 image/Image#<Layerrust-analyzer cargo exr 1.74.0 image/Layer#<SpecificChannelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#<Storage, Channels>>>; |
| 58 |
|
| 59 |
/// This image type contains multiple layers, with each layer containing a user-defined type of rgba pixels. |
| 60 |
pub type RgbaLayersImagerust-analyzer cargo exr 1.74.0 image/RgbaLayersImage#<Storage> = PixelLayersImagerust-analyzer cargo exr 1.74.0 image/PixelLayersImage#<Storage, RgbaChannelsrust-analyzer cargo exr 1.74.0 image/RgbaChannels#>; |
| 61 |
|
| 62 |
/// This image type contains a single layer containing a user-defined type of rgba pixels. |
| 63 |
pub type RgbaImagerust-analyzer cargo exr 1.74.0 image/RgbaImage#<Storage> = PixelImagerust-analyzer cargo exr 1.74.0 image/PixelImage#<Storage, RgbaChannelsrust-analyzer cargo exr 1.74.0 image/RgbaChannels#>; |
| 64 |
|
| 65 |
/// Contains information about the channels in an rgba image, in the order `(red, green, blue, alpha)`. |
| 66 |
/// The alpha channel is not required. May be `None` if the image did not contain an alpha channel. |
| 67 |
pub type RgbaChannelsrust-analyzer cargo exr 1.74.0 image/RgbaChannels# = (ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#, ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#, ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#>); |
| 68 |
|
| 69 |
/// Contains information about the channels in an rgb image, in the order `(red, green, blue)`. |
| 70 |
pub type RgbChannelsrust-analyzer cargo exr 1.74.0 image/RgbChannels# = (ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#, ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#, ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#); |
| 71 |
|
| 72 |
/// The complete exr image. |
| 73 |
/// `Layers` can be either a single `Layer` or `Layers`. |
| 74 |
#[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:)] |
| 75 |
pub struct Imagerust-analyzer cargo exr 1.74.0 image/Image#<Layers> { |
| 76 |
|
| 77 |
/// Attributes that apply to the whole image file. |
| 78 |
/// These attributes appear in each layer of the file. |
| 79 |
/// Excludes technical meta data. |
| 80 |
/// Each layer in this image also has its own attributes. |
| 81 |
pub attributesrust-analyzer cargo exr 1.74.0 image/Image#attributes.: ImageAttributesrust-analyzer cargo exr 1.74.0 meta/header/ImageAttributes#, |
| 82 |
|
| 83 |
/// The layers contained in the image file. |
| 84 |
/// Can be either a single `Layer` or a list of layers. |
| 85 |
pub layer_datarust-analyzer cargo exr 1.74.0 image/Image#layer_data.: Layers, |
| 86 |
} |
| 87 |
|
| 88 |
/// A list of layers. `Channels` can be `SpecificChannels` or `AnyChannels`. |
| 89 |
pub type Layersrust-analyzer cargo exr 1.74.0 image/Layers#<Channels> = SmallVecrust-analyzer cargo smallvec 1.15.1 SmallVec#<[Layerrust-analyzer cargo exr 1.74.0 image/Layer#<Channels>; 2]>; |
| 90 |
|
| 91 |
/// A single Layer, including fancy attributes and compression settings. |
| 92 |
/// `Channels` can be either `SpecificChannels` or `AnyChannels` |
| 93 |
#[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:)] |
| 94 |
pub struct Layerrust-analyzer cargo exr 1.74.0 image/Layer#<Channels> { |
| 95 |
|
| 96 |
/// The actual pixel data. Either `SpecificChannels` or `AnyChannels` |
| 97 |
pub channel_datarust-analyzer cargo exr 1.74.0 image/Layer#channel_data.: Channels, |
| 98 |
|
| 99 |
/// Attributes that apply to this layer. |
| 100 |
/// May still contain attributes that should be considered global for an image file. |
| 101 |
/// Excludes technical meta data: Does not contain data window size, line order, tiling, or compression attributes. |
| 102 |
/// The image also has attributes, which do not differ per layer. |
| 103 |
pub attributesrust-analyzer cargo exr 1.74.0 image/Layer#attributes.: LayerAttributesrust-analyzer cargo exr 1.74.0 meta/header/LayerAttributes#, |
| 104 |
|
| 105 |
/// The pixel resolution of this layer. |
| 106 |
/// See `layer.attributes` for more attributes, like for example layer position. |
| 107 |
pub sizerust-analyzer cargo exr 1.74.0 image/Layer#size.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<usize>, |
| 108 |
|
| 109 |
/// How the pixels are split up and compressed. |
| 110 |
pub encodingrust-analyzer cargo exr 1.74.0 image/Layer#encoding.: Encodingrust-analyzer cargo exr 1.74.0 image/Encoding# |
| 111 |
} |
| 112 |
|
| 113 |
/// How the pixels are split up and compressed. |
| 114 |
#[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:, 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:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 115 |
pub struct Encodingrust-analyzer cargo exr 1.74.0 image/Encoding# { |
| 116 |
|
| 117 |
/// How the pixel data of all channels in this layer is compressed. May be `Compression::Uncompressed`. |
| 118 |
/// See `layer.attributes` for more attributes. |
| 119 |
pub compressionrust-analyzer cargo exr 1.74.0 image/Encoding#compression.: Compressionrust-analyzer cargo exr 1.74.0 compression/Compression#, |
| 120 |
|
| 121 |
/// Describes how the pixels of this layer are divided into smaller blocks. |
| 122 |
/// Either splits the image into its scan lines or splits the image into tiles of the specified size. |
| 123 |
/// A single block can be loaded without processing all bytes of a file. |
| 124 |
pub blocksrust-analyzer cargo exr 1.74.0 image/Encoding#blocks.: Blocksrust-analyzer cargo exr 1.74.0 image/Blocks#, |
| 125 |
|
| 126 |
/// In what order the tiles of this header occur in the file. |
| 127 |
/// Does not change any actual image orientation. |
| 128 |
/// See `layer.attributes` for more attributes. |
| 129 |
pub line_orderrust-analyzer cargo exr 1.74.0 image/Encoding#line_order.: LineOrderrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#, |
| 130 |
} |
| 131 |
|
| 132 |
/// How the image pixels are split up into separate blocks. |
| 133 |
#[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:, 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:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| 134 |
pub enum Blocksrust-analyzer cargo exr 1.74.0 image/Blocks# { |
| 135 |
|
| 136 |
/// The image is divided into scan line blocks. |
| 137 |
/// The number of scan lines in a block depends on the compression method. |
| 138 |
ScanLinesrust-analyzer cargo exr 1.74.0 image/Blocks#ScanLines#, |
| 139 |
|
| 140 |
/// The image is divided into tile blocks. |
| 141 |
/// Also specifies the size of each tile in the image |
| 142 |
/// and whether this image contains multiple resolution levels. |
| 143 |
/// |
| 144 |
/// The inner `Vec2` describes the size of each tile. |
| 145 |
/// Stays the same number of pixels across all levels. |
| 146 |
Tilesrust-analyzer cargo exr 1.74.0 image/Blocks#Tiles# (Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<usize>) |
| 147 |
} |
| 148 |
|
| 149 |
|
| 150 |
/// A grid of pixels. The pixels are written to your custom pixel storage. |
| 151 |
/// `PixelStorage` can be anything, from a flat `Vec<f16>` to `Vec<Vec<AnySample>>`, as desired. |
| 152 |
/// In order to write this image to a file, your `PixelStorage` must implement [`GetPixel`]. |
| 153 |
#[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:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| 154 |
pub struct SpecificChannelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#<Pixels, ChannelsDescription> { |
| 155 |
|
| 156 |
/// A description of the channels in the file, as opposed to the channels in memory. |
| 157 |
/// Should always be a tuple containing `ChannelDescription`s, one description for each channel. |
| 158 |
pub channelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#channels.: ChannelsDescription, // TODO this is awkward. can this be not a type parameter please? maybe vec<option<chan_info>> ?? |
| 159 |
|
| 160 |
/// Your custom pixel storage |
| 161 |
// TODO should also support `Levels<YourStorage>`, where levels are desired! |
| 162 |
pub pixelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#pixels.: Pixels, // TODO rename to "pixels"? |
| 163 |
} |
| 164 |
|
| 165 |
|
| 166 |
/// A dynamic list of arbitrary channels. |
| 167 |
/// `Samples` can currently only be `FlatSamples` or `Levels<FlatSamples>`. |
| 168 |
#[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:)] |
| 169 |
pub struct AnyChannelsrust-analyzer cargo exr 1.74.0 image/AnyChannels#<Samples> { |
| 170 |
|
| 171 |
/// This list must be sorted alphabetically, by channel name. |
| 172 |
/// Use `AnyChannels::sorted` for automatic sorting. |
| 173 |
pub listrust-analyzer cargo exr 1.74.0 image/AnyChannels#list.: SmallVecrust-analyzer cargo smallvec 1.15.1 SmallVec#<[AnyChannelrust-analyzer cargo exr 1.74.0 image/AnyChannel#<Samples>; 4]> |
| 174 |
} |
| 175 |
|
| 176 |
/// A single arbitrary channel. |
| 177 |
/// `Samples` can currently only be `FlatSamples` or `Levels<FlatSamples>` |
| 178 |
#[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:)] |
| 179 |
pub struct AnyChannelrust-analyzer cargo exr 1.74.0 image/AnyChannel#<Samples> { |
| 180 |
|
| 181 |
/// One of "R", "G", or "B" most of the time. |
| 182 |
pub namerust-analyzer cargo exr 1.74.0 image/AnyChannel#name.: Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#, |
| 183 |
|
| 184 |
/// The actual pixel data. |
| 185 |
/// Can be `FlatSamples` or `Levels<FlatSamples>`. |
| 186 |
pub sample_datarust-analyzer cargo exr 1.74.0 image/AnyChannel#sample_data.: Samples, |
| 187 |
|
| 188 |
/// This attribute only tells lossy compression methods |
| 189 |
/// whether this value should be quantized exponentially or linearly. |
| 190 |
/// |
| 191 |
/// Should be `false` for red, green, blue and luma channels, as they are not perceived linearly. |
| 192 |
/// Should be `true` for hue, chroma, saturation, and alpha channels. |
| 193 |
pub quantize_linearlyrust-analyzer cargo exr 1.74.0 image/AnyChannel#quantize_linearly.: bool, |
| 194 |
|
| 195 |
/// How many of the samples are skipped compared to the other channels in this layer. |
| 196 |
/// |
| 197 |
/// Can be used for chroma subsampling for manual lossy data compression. |
| 198 |
/// Values other than 1 are allowed only in flat, scan-line based images. |
| 199 |
/// If an image is deep or tiled, the sampling rates for all of its channels must be 1. |
| 200 |
pub samplingrust-analyzer cargo exr 1.74.0 image/AnyChannel#sampling.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<usize>, |
| 201 |
} |
| 202 |
|
| 203 |
/// One or multiple resolution levels of the same image. |
| 204 |
/// `Samples` can be `FlatSamples`. |
| 205 |
#[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:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| 206 |
pub enum Levelsrust-analyzer cargo exr 1.74.0 image/Levels#<Samples> { |
| 207 |
|
| 208 |
/// A single image without smaller versions of itself. |
| 209 |
/// If you only want to handle exclusively this case, use `Samples` directly, and not `Levels<Samples>`. |
| 210 |
Singularrust-analyzer cargo exr 1.74.0 image/Levels#Singular#(Samples), |
| 211 |
|
| 212 |
/// Contains uniformly scaled smaller versions of the original. |
| 213 |
Miprust-analyzer cargo exr 1.74.0 image/Levels#Mip# |
| 214 |
{ |
| 215 |
/// Whether to round up or down when calculating Mip/Rip levels. |
| 216 |
rounding_moderust-analyzer cargo exr 1.74.0 image/Levels#Mip#rounding_mode.: RoundingModerust-analyzer cargo exr 1.74.0 math/RoundingMode#, |
| 217 |
|
| 218 |
/// The smaller versions of the original. |
| 219 |
level_datarust-analyzer cargo exr 1.74.0 image/Levels#Mip#level_data.: LevelMapsrust-analyzer cargo exr 1.74.0 image/LevelMaps#<Samples> |
| 220 |
}, |
| 221 |
|
| 222 |
/// Contains any possible combination of smaller versions of the original. |
| 223 |
Riprust-analyzer cargo exr 1.74.0 image/Levels#Rip# |
| 224 |
{ |
| 225 |
/// Whether to round up or down when calculating Mip/Rip levels. |
| 226 |
rounding_moderust-analyzer cargo exr 1.74.0 image/Levels#Rip#rounding_mode.: RoundingModerust-analyzer cargo exr 1.74.0 math/RoundingMode#, |
| 227 |
|
| 228 |
/// The smaller versions of the original. |
| 229 |
level_datarust-analyzer cargo exr 1.74.0 image/Levels#Rip#level_data.: RipMapsrust-analyzer cargo exr 1.74.0 image/RipMaps#<Samples> |
| 230 |
}, |
| 231 |
} |
| 232 |
|
| 233 |
/// A list of resolution levels. `Samples` can currently only be `FlatSamples`. |
| 234 |
// or `DeepAndFlatSamples` (not yet implemented). |
| 235 |
pub type LevelMapsrust-analyzer cargo exr 1.74.0 image/LevelMaps#<Samples> = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Samples>; |
| 236 |
|
| 237 |
/// In addition to the full resolution image, |
| 238 |
/// this layer also contains smaller versions, |
| 239 |
/// and each smaller version has further versions with varying aspect ratios. |
| 240 |
/// `Samples` can currently only be `FlatSamples`. |
| 241 |
#[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:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| 242 |
pub struct RipMapsrust-analyzer cargo exr 1.74.0 image/RipMaps#<Samples> { |
| 243 |
|
| 244 |
/// A flattened list containing the individual levels |
| 245 |
pub map_datarust-analyzer cargo exr 1.74.0 image/RipMaps#map_data.: LevelMapsrust-analyzer cargo exr 1.74.0 image/LevelMaps#<Samples>, |
| 246 |
|
| 247 |
/// The number of levels that were generated along the x-axis and y-axis. |
| 248 |
pub level_countrust-analyzer cargo exr 1.74.0 image/RipMaps#level_count.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<usize>, |
| 249 |
} |
| 250 |
|
| 251 |
|
| 252 |
// TODO deep data |
| 253 |
/*#[derive(Clone, PartialEq)] |
| 254 |
pub enum DeepAndFlatSamples { |
| 255 |
Deep(DeepSamples), |
| 256 |
Flat(FlatSamples) |
| 257 |
}*/ |
| 258 |
|
| 259 |
/// A vector of non-deep values (one value per pixel per channel). |
| 260 |
/// Stores row after row in a single vector. |
| 261 |
/// The precision of all values is either `f16`, `f32` or `u32`. |
| 262 |
/// |
| 263 |
/// Since this is close to the pixel layout in the byte file, |
| 264 |
/// this will most likely be the fastest storage. |
| 265 |
/// Using a different storage, for example `SpecificChannels`, |
| 266 |
/// will probably be slower. |
| 267 |
#[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:)] // debug is implemented manually |
| 268 |
pub enum FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples# { |
| 269 |
|
| 270 |
/// A vector of non-deep `f16` values. |
| 271 |
F16rust-analyzer cargo exr 1.74.0 image/FlatSamples#F16#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<f16rust-analyzer cargo half 2.6.0 binary16/f16#>), |
| 272 |
|
| 273 |
/// A vector of non-deep `f32` values. |
| 274 |
F32rust-analyzer cargo exr 1.74.0 image/FlatSamples#F32#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<f32>), |
| 275 |
|
| 276 |
/// A vector of non-deep `u32` values. |
| 277 |
U32rust-analyzer cargo exr 1.74.0 image/FlatSamples#U32#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u32>), |
| 278 |
} |
| 279 |
|
| 280 |
|
| 281 |
/*#[derive(Clone, PartialEq)] |
| 282 |
pub enum DeepSamples { |
| 283 |
F16(Vec<Vec<f16>>), |
| 284 |
F32(Vec<Vec<f32>>), |
| 285 |
U32(Vec<Vec<u32>>), |
| 286 |
}*/ |
| 287 |
|
| 288 |
use craterust-analyzer cargo exr 1.74.0 crate/::blockrust-analyzer cargo exr 1.74.0 block/::samplesrust-analyzer cargo exr 1.74.0 block/samples/::*; |
| 289 |
use craterust-analyzer cargo exr 1.74.0 crate/::metarust-analyzer cargo exr 1.74.0 meta/::attributerust-analyzer cargo exr 1.74.0 meta/attribute/::*; |
| 290 |
use craterust-analyzer cargo exr 1.74.0 crate/::errorrust-analyzer cargo exr 1.74.0 error/::Resultrust-analyzer cargo exr 1.74.0 error/Result#; |
| 291 |
use craterust-analyzer cargo exr 1.74.0 crate/::blockrust-analyzer cargo exr 1.74.0 block/::samplesrust-analyzer cargo exr 1.74.0 block/samples/::Samplerust-analyzer cargo exr 1.74.0 block/samples/Sample#; |
| 292 |
use craterust-analyzer cargo exr 1.74.0 crate/::imagerust-analyzer cargo exr 1.74.0 image/::writerust-analyzer cargo exr 1.74.0 image/write/::channelsrust-analyzer cargo exr 1.74.0 image/write/channels/::*; |
| 293 |
use craterust-analyzer cargo exr 1.74.0 crate/::imagerust-analyzer cargo exr 1.74.0 image/::writerust-analyzer cargo exr 1.74.0 image/write/::layersrust-analyzer cargo exr 1.74.0 image/write/layers/::WritableLayersrust-analyzer cargo exr 1.74.0 image/write/layers/WritableLayers#; |
| 294 |
use craterust-analyzer cargo exr 1.74.0 crate/::imagerust-analyzer cargo exr 1.74.0 image/::writerust-analyzer cargo exr 1.74.0 image/write/::samplesrust-analyzer cargo exr 1.74.0 image/write/samples/::{WritableSamplesrust-analyzer cargo exr 1.74.0 image/write/samples/WritableSamples#}; |
| 295 |
use craterust-analyzer cargo exr 1.74.0 crate/::metarust-analyzer cargo exr 1.74.0 meta/::{mip_map_levelsrust-analyzer cargo exr 1.74.0 meta/mip_map_levels()., rip_map_levelsrust-analyzer cargo exr 1.74.0 meta/rip_map_levels().}; |
| 296 |
use craterust-analyzer cargo exr 1.74.0 crate/::iorust-analyzer cargo exr 1.74.0 io/::Datarust-analyzer cargo exr 1.74.0 io/Data#; |
| 297 |
use craterust-analyzer cargo exr 1.74.0 crate/::imagerust-analyzer cargo exr 1.74.0 image/::recursiverust-analyzer cargo exr 1.74.0 image/recursive/::{NoneMorerust-analyzer cargo exr 1.74.0 image/recursive/NoneMore#, Recursiverust-analyzer cargo exr 1.74.0 image/recursive/Recursive#, IntoRecursiverust-analyzer cargo exr 1.74.0 image/recursive/IntoRecursive#}; |
| 298 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#; |
| 299 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Notrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/Not#; |
| 300 |
use craterust-analyzer cargo exr 1.74.0 crate/::imagerust-analyzer cargo exr 1.74.0 image/::validate_resultsrust-analyzer cargo exr 1.74.0 image/validate_results/::{ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#}; |
| 301 |
|
| 302 |
|
| 303 |
impl<Channels> Layerrust-analyzer cargo exr 1.74.0 image/Layer#<Channels> { |
| 304 |
/// Sometimes called "data window" |
| 305 |
pub fn absolute_boundsrust-analyzer cargo exr 1.74.0 image/impl#[`Layer<Channels>`]absolute_bounds().(&self) -> IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds# { |
| 306 |
IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#::newrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]new().(self.attributesrust-analyzer cargo exr 1.74.0 image/Layer#attributes..layer_positionrust-analyzer cargo exr 1.74.0 meta/header/LayerAttributes#layer_position., self.sizerust-analyzer cargo exr 1.74.0 image/Layer#size.) |
| 307 |
} |
| 308 |
} |
| 309 |
|
| 310 |
|
| 311 |
impl<SampleStorage, Channels> SpecificChannelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#<SampleStorage, Channels> { |
| 312 |
/// Create some pixels with channel information. |
| 313 |
/// The `Channels` must be a tuple containing either `ChannelDescription` or `Option<ChannelDescription>`. |
| 314 |
/// The length of the tuple dictates the number of channels in the sample storage. |
| 315 |
pub fn newrust-analyzer cargo exr 1.74.0 image/impl#[`SpecificChannels<SampleStorage, Channels>`]new().(channels: Channels, source_samples: SampleStorage) -> Selfrust-analyzer cargo exr 1.74.0 image/impl#[`SpecificChannels<SampleStorage, Channels>`] |
| 316 |
where |
| 317 |
SampleStorage: GetPixelrust-analyzer cargo exr 1.74.0 image/write/channels/GetPixel#, |
| 318 |
SampleStorage::Pixelrust-analyzer cargo exr 1.74.0 image/write/channels/GetPixel#Pixel#: IntoRecursiverust-analyzer cargo exr 1.74.0 image/recursive/IntoRecursive#, |
| 319 |
Channels: Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + IntoRecursiverust-analyzer cargo exr 1.74.0 image/recursive/IntoRecursive#, |
| 320 |
<Channels as IntoRecursiverust-analyzer cargo exr 1.74.0 image/recursive/IntoRecursive#>::Recursiverust-analyzer cargo exr 1.74.0 image/recursive/IntoRecursive#Recursive#: WritableChannelsDescriptionrust-analyzer cargo exr 1.74.0 image/write/channels/WritableChannelsDescription#<<SampleStorage::Pixelrust-analyzer cargo exr 1.74.0 image/write/channels/GetPixel#Pixel# as IntoRecursiverust-analyzer cargo exr 1.74.0 image/recursive/IntoRecursive#>::Recursiverust-analyzer cargo exr 1.74.0 image/recursive/IntoRecursive#Recursive#>, |
| 321 |
{ |
| 322 |
SpecificChannelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels# { channelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#channels., pixelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#pixels.: source_samples } |
| 323 |
} |
| 324 |
} |
| 325 |
|
| 326 |
/// Convert this type into one of the known sample types. |
| 327 |
/// Also specify the preferred native type, which dictates the default sample type in the image. |
| 328 |
pub trait IntoSamplerust-analyzer cargo exr 1.74.0 image/IntoSample#: IntoNativeSamplerust-analyzer cargo exr 1.74.0 block/samples/IntoNativeSample# { |
| 329 |
|
| 330 |
/// The native sample types that this type should be converted to. |
| 331 |
const PREFERRED_SAMPLE_TYPErust-analyzer cargo exr 1.74.0 image/IntoSample#PREFERRED_SAMPLE_TYPE.: SampleTyperust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#; |
| 332 |
} |
| 333 |
|
| 334 |
impl IntoSamplerust-analyzer cargo exr 1.74.0 image/IntoSample# for f16rust-analyzer cargo half 2.6.0 binary16/f16# { const PREFERRED_SAMPLE_TYPErust-analyzer cargo exr 1.74.0 image/impl#[f16][IntoSample]PREFERRED_SAMPLE_TYPE.: SampleTyperust-analyzer cargo exr 1.74.0 meta/attribute/SampleType# = SampleTyperust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#::F16rust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#F16#; } |
| 335 |
impl IntoSamplerust-analyzer cargo exr 1.74.0 image/IntoSample# for f32 { const PREFERRED_SAMPLE_TYPErust-analyzer cargo exr 1.74.0 image/impl#[f32][IntoSample]PREFERRED_SAMPLE_TYPE.: SampleTyperust-analyzer cargo exr 1.74.0 meta/attribute/SampleType# = SampleTyperust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#::F32rust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#F32#; } |
| 336 |
impl IntoSamplerust-analyzer cargo exr 1.74.0 image/IntoSample# for u32 { const PREFERRED_SAMPLE_TYPErust-analyzer cargo exr 1.74.0 image/impl#[u32][IntoSample]PREFERRED_SAMPLE_TYPE.: SampleTyperust-analyzer cargo exr 1.74.0 meta/attribute/SampleType# = SampleTyperust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#::U32rust-analyzer cargo exr 1.74.0 meta/attribute/SampleType#U32#; } |
| 337 |
|
| 338 |
/// Used to construct a `SpecificChannels`. |
| 339 |
/// Call `with_named_channel` as many times as desired, |
| 340 |
/// and then call `with_pixels` to define the colors. |
| 341 |
#[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:)] |
| 342 |
pub struct SpecificChannelsBuilderrust-analyzer cargo exr 1.74.0 image/SpecificChannelsBuilder#<RecursiveChannels, RecursivePixel> { |
| 343 |
channelsrust-analyzer cargo exr 1.74.0 image/SpecificChannelsBuilder#channels.: RecursiveChannels, |
| 344 |
pxrust-analyzer cargo exr 1.74.0 image/SpecificChannelsBuilder#px.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<RecursivePixel> |
| 345 |
} |
| 346 |
|
| 347 |
/// This check can be executed at compile time |
| 348 |
/// if the channel names are `&'static str` and the compiler is smart enough. |
| 349 |
pub trait CheckDuplicatesrust-analyzer cargo exr 1.74.0 image/CheckDuplicates# { |
| 350 |
|
| 351 |
/// Check for duplicate channel names. |
| 352 |
fn already_containsrust-analyzer cargo exr 1.74.0 image/CheckDuplicates#already_contains().(&self, name: &Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#) -> bool; |
| 353 |
} |
| 354 |
|
| 355 |
impl CheckDuplicatesrust-analyzer cargo exr 1.74.0 image/CheckDuplicates# for NoneMorerust-analyzer cargo exr 1.74.0 image/recursive/NoneMore# { |
| 356 |
fn already_containsrust-analyzer cargo exr 1.74.0 image/impl#[NoneMore][CheckDuplicates]already_contains().(&self, _: &Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#) -> bool { false } |
| 357 |
} |
| 358 |
|
| 359 |
impl<Inner: CheckDuplicatesrust-analyzer cargo exr 1.74.0 image/CheckDuplicates#> CheckDuplicatesrust-analyzer cargo exr 1.74.0 image/CheckDuplicates# for Recursiverust-analyzer cargo exr 1.74.0 image/recursive/Recursive#<Inner, ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#> { |
| 360 |
fn already_containsrust-analyzer cargo exr 1.74.0 image/impl#[`Recursive<Inner, ChannelDescription>`][CheckDuplicates]already_contains().(&self, name: &Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text#) -> bool { |
| 361 |
&self.valuerust-analyzer cargo exr 1.74.0 image/recursive/Recursive#value..namerust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#name. 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().name || self.innerrust-analyzer cargo exr 1.74.0 image/recursive/Recursive#inner..already_containsrust-analyzer cargo exr 1.74.0 image/CheckDuplicates#already_contains().(name) |
| 362 |
} |
| 363 |
} |
| 364 |
|
| 365 |
impl SpecificChannelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#<(),()> |
| 366 |
{ |
| 367 |
/// Start building some specific channels. On the result of this function, |
| 368 |
/// call `with_named_channel` as many times as desired, |
| 369 |
/// and then call `with_pixels` to define the colors. |
| 370 |
pub fn buildrust-analyzer cargo exr 1.74.0 image/impl#[`SpecificChannels<(), ()>`]build().() -> SpecificChannelsBuilderrust-analyzer cargo exr 1.74.0 image/SpecificChannelsBuilder#<NoneMorerust-analyzer cargo exr 1.74.0 image/recursive/NoneMore#, NoneMorerust-analyzer cargo exr 1.74.0 image/recursive/NoneMore#> { |
| 371 |
SpecificChannelsBuilderrust-analyzer cargo exr 1.74.0 image/SpecificChannelsBuilder# { channelsrust-analyzer cargo exr 1.74.0 image/SpecificChannelsBuilder#channels.: NoneMorerust-analyzer cargo exr 1.74.0 image/recursive/NoneMore#, pxrust-analyzer cargo exr 1.74.0 image/SpecificChannelsBuilder#px.: Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/impl#[`PhantomData<T>`][Default]default().() } |
| 372 |
} |
| 373 |
} |
| 374 |
|
| 375 |
impl<RecursiveChannels: CheckDuplicatesrust-analyzer cargo exr 1.74.0 image/CheckDuplicates#, RecursivePixel> SpecificChannelsBuilderrust-analyzer cargo exr 1.74.0 image/SpecificChannelsBuilder#<RecursiveChannels, RecursivePixel> |
| 376 |
{ |
| 377 |
/// Add another channel to this image. Does not add the actual pixels, |
| 378 |
/// but instead only declares the presence of the channel. |
| 379 |
/// Panics if the name contains unsupported characters. |
| 380 |
/// Panics if a channel with the same name already exists. |
| 381 |
/// Use `Text::new_or_none()` to manually handle these cases. |
| 382 |
/// Use `with_channel_details` instead if you want to specify more options than just the name of the channel. |
| 383 |
/// The generic parameter can usually be inferred from the closure in `with_pixels`. |
| 384 |
pub fn with_channelrust-analyzer cargo exr 1.74.0 image/impl#[`SpecificChannelsBuilder<RecursiveChannels, RecursivePixel>`]with_channel().<Sample: IntoSamplerust-analyzer cargo exr 1.74.0 image/IntoSample#>(self, 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#>) |
| 385 |
-> SpecificChannelsBuilderrust-analyzer cargo exr 1.74.0 image/SpecificChannelsBuilder#<Recursiverust-analyzer cargo exr 1.74.0 image/recursive/Recursive#<RecursiveChannels, ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#>, Recursiverust-analyzer cargo exr 1.74.0 image/recursive/Recursive#<RecursivePixel, Sample>> |
| 386 |
{ |
| 387 |
self.with_channel_detailsrust-analyzer cargo exr 1.74.0 image/impl#[`SpecificChannelsBuilder<RecursiveChannels, RecursivePixel>`]with_channel_details().::<Sample>(ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#::namedrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]named().(name, Sample::PREFERRED_SAMPLE_TYPErust-analyzer cargo exr 1.74.0 image/IntoSample#PREFERRED_SAMPLE_TYPE.)) |
| 388 |
} |
| 389 |
|
| 390 |
/// Add another channel to this image. Does not add the actual pixels, |
| 391 |
/// but instead only declares the presence of the channel. |
| 392 |
/// Use `with_channel` instead if you only want to specify the name of the channel. |
| 393 |
/// Panics if a channel with the same name already exists. |
| 394 |
/// The generic parameter can usually be inferred from the closure in `with_pixels`. |
| 395 |
pub fn with_channel_detailsrust-analyzer cargo exr 1.74.0 image/impl#[`SpecificChannelsBuilder<RecursiveChannels, RecursivePixel>`]with_channel_details().<Sample: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Sample>>(self, channel: ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#) |
| 396 |
-> SpecificChannelsBuilderrust-analyzer cargo exr 1.74.0 image/SpecificChannelsBuilder#<Recursiverust-analyzer cargo exr 1.74.0 image/recursive/Recursive#<RecursiveChannels, ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#>, Recursiverust-analyzer cargo exr 1.74.0 image/recursive/Recursive#<RecursivePixel, Sample>> |
| 397 |
{ |
| 398 |
// duplicate channel names are checked later, but also check now to make sure there are no problems with the `SpecificChannelsWriter` |
| 399 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(self.channelsrust-analyzer cargo exr 1.74.0 image/SpecificChannelsBuilder#channels..already_containsrust-analyzer cargo exr 1.74.0 image/CheckDuplicates#already_contains().(&channel.namerust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#name.).notrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().(), "channel name `{}` is duplicate", channel.namerust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#name.); |
| 400 |
|
| 401 |
SpecificChannelsBuilderrust-analyzer cargo exr 1.74.0 image/SpecificChannelsBuilder# { |
| 402 |
channelsrust-analyzer cargo exr 1.74.0 image/SpecificChannelsBuilder#channels.: Recursiverust-analyzer cargo exr 1.74.0 image/recursive/Recursive#::newrust-analyzer cargo exr 1.74.0 image/recursive/impl#[`Recursive<Inner, Value>`]new().(self.channelsrust-analyzer cargo exr 1.74.0 image/SpecificChannelsBuilder#channels., channel), |
| 403 |
pxrust-analyzer cargo exr 1.74.0 image/SpecificChannelsBuilder#px.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#::defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/impl#[`PhantomData<T>`][Default]default().() |
| 404 |
} |
| 405 |
} |
| 406 |
|
| 407 |
/// Specify the actual pixel contents of the image. |
| 408 |
/// You can pass a closure that returns a color for each pixel (`Fn(Vec2<usize>) -> Pixel`), |
| 409 |
/// or you can pass your own image if it implements `GetPixel`. |
| 410 |
/// The pixel type must be a tuple with the correct number of entries, depending on the number of channels. |
| 411 |
/// The tuple entries can be either `f16`, `f32`, `u32` or `Sample`. |
| 412 |
/// Use `with_pixel_fn` instead of this function, to get extra type safety for your pixel closure. |
| 413 |
pub fn with_pixelsrust-analyzer cargo exr 1.74.0 image/impl#[`SpecificChannelsBuilder<RecursiveChannels, RecursivePixel>`]with_pixels().<Pixels>(self, get_pixel: Pixels) -> SpecificChannelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#<Pixels, RecursiveChannels> |
| 414 |
where Pixels: GetPixelrust-analyzer cargo exr 1.74.0 image/write/channels/GetPixel#, <Pixels as GetPixelrust-analyzer cargo exr 1.74.0 image/write/channels/GetPixel#>::Pixelrust-analyzer cargo exr 1.74.0 image/write/channels/GetPixel#Pixel#: IntoRecursiverust-analyzer cargo exr 1.74.0 image/recursive/IntoRecursive#<Recursiverust-analyzer cargo exr 1.74.0 image/recursive/IntoRecursive#Recursive#=RecursivePixel>, |
| 415 |
{ |
| 416 |
SpecificChannelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels# { |
| 417 |
channelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#channels.: self.channelsrust-analyzer cargo exr 1.74.0 image/SpecificChannelsBuilder#channels., |
| 418 |
pixelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#pixels.: get_pixel |
| 419 |
} |
| 420 |
} |
| 421 |
|
| 422 |
/// Specify the contents of the image. |
| 423 |
/// The pixel type must be a tuple with the correct number of entries, depending on the number of channels. |
| 424 |
/// The tuple entries can be either `f16`, `f32`, `u32` or `Sample`. |
| 425 |
/// Use `with_pixels` instead of this function, if you want to pass an object that is not a closure. |
| 426 |
/// |
| 427 |
/// Usually, the compiler can infer the type of the pixel (for example, `f16,f32,f32`) from the closure. |
| 428 |
/// If that's not possible, you can specify the type of the channels |
| 429 |
/// when declaring the channel (for example, `with_named_channel::<f32>("R")`). |
| 430 |
pub fn with_pixel_fnrust-analyzer cargo exr 1.74.0 image/impl#[`SpecificChannelsBuilder<RecursiveChannels, RecursivePixel>`]with_pixel_fn().<Pixel, Pixels>(self, get_pixel: Pixels) -> SpecificChannelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#<Pixels, RecursiveChannels> |
| 431 |
where Pixels: Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#(Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<usize>) -> Pixel, Pixel: IntoRecursiverust-analyzer cargo exr 1.74.0 image/recursive/IntoRecursive#<Recursiverust-analyzer cargo exr 1.74.0 image/recursive/IntoRecursive#Recursive#=RecursivePixel>, |
| 432 |
{ |
| 433 |
SpecificChannelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels# { |
| 434 |
channelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#channels.: self.channelsrust-analyzer cargo exr 1.74.0 image/SpecificChannelsBuilder#channels., |
| 435 |
pixelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#pixels.: get_pixel |
| 436 |
} |
| 437 |
} |
| 438 |
} |
| 439 |
|
| 440 |
impl<SampleStorage> SpecificChannelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#< |
| 441 |
SampleStorage, (ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#, ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#, ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#, ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#) |
| 442 |
> |
| 443 |
{ |
| 444 |
|
| 445 |
/// Create an image with red, green, blue, and alpha channels. |
| 446 |
/// You can pass a closure that returns a color for each pixel (`Fn(Vec2<usize>) -> (R,G,B,A)`), |
| 447 |
/// or you can pass your own image if it implements `GetPixel<Pixel=(R,G,B,A)>`. |
| 448 |
/// Each of `R`, `G`, `B` and `A` can be either `f16`, `f32`, `u32`, or `Sample`. |
| 449 |
pub fn rgbarust-analyzer cargo exr 1.74.0 image/impl#[`SpecificChannels<SampleStorage, (ChannelDescription, ChannelDescription, ChannelDescription, ChannelDescription)>`]rgba().<R, G, B, A>(source_samples: SampleStorage) -> Selfrust-analyzer cargo exr 1.74.0 image/impl#[`SpecificChannels<SampleStorage, (ChannelDescription, ChannelDescription, ChannelDescription, ChannelDescription)>`] |
| 450 |
where R: IntoSamplerust-analyzer cargo exr 1.74.0 image/IntoSample#, G: IntoSamplerust-analyzer cargo exr 1.74.0 image/IntoSample#, |
| 451 |
B: IntoSamplerust-analyzer cargo exr 1.74.0 image/IntoSample#, A: IntoSamplerust-analyzer cargo exr 1.74.0 image/IntoSample#, |
| 452 |
SampleStorage: GetPixelrust-analyzer cargo exr 1.74.0 image/write/channels/GetPixel#<Pixelrust-analyzer cargo exr 1.74.0 image/write/channels/GetPixel#Pixel#=(R, G, B, A)> |
| 453 |
{ |
| 454 |
SpecificChannelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels# { |
| 455 |
channelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#channels.: ( |
| 456 |
ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#::namedrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]named().("R", R::PREFERRED_SAMPLE_TYPErust-analyzer cargo exr 1.74.0 image/IntoSample#PREFERRED_SAMPLE_TYPE.), |
| 457 |
ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#::namedrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]named().("G", G::PREFERRED_SAMPLE_TYPErust-analyzer cargo exr 1.74.0 image/IntoSample#PREFERRED_SAMPLE_TYPE.), |
| 458 |
ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#::namedrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]named().("B", B::PREFERRED_SAMPLE_TYPErust-analyzer cargo exr 1.74.0 image/IntoSample#PREFERRED_SAMPLE_TYPE.), |
| 459 |
ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#::namedrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]named().("A", A::PREFERRED_SAMPLE_TYPErust-analyzer cargo exr 1.74.0 image/IntoSample#PREFERRED_SAMPLE_TYPE.), |
| 460 |
), |
| 461 |
pixelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#pixels.: source_samples |
| 462 |
} |
| 463 |
} |
| 464 |
} |
| 465 |
|
| 466 |
impl<SampleStorage> SpecificChannelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#< |
| 467 |
SampleStorage, (ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#, ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#, ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#) |
| 468 |
> |
| 469 |
{ |
| 470 |
|
| 471 |
/// Create an image with red, green, and blue channels. |
| 472 |
/// You can pass a closure that returns a color for each pixel (`Fn(Vec2<usize>) -> (R,G,B)`), |
| 473 |
/// or you can pass your own image if it implements `GetPixel<Pixel=(R,G,B)>`. |
| 474 |
/// Each of `R`, `G` and `B` can be either `f16`, `f32`, `u32`, or `Sample`. |
| 475 |
pub fn rgbrust-analyzer cargo exr 1.74.0 image/impl#[`SpecificChannels<SampleStorage, (ChannelDescription, ChannelDescription, ChannelDescription)>`]rgb().<R, G, B>(source_samples: SampleStorage) -> Selfrust-analyzer cargo exr 1.74.0 image/impl#[`SpecificChannels<SampleStorage, (ChannelDescription, ChannelDescription, ChannelDescription)>`] |
| 476 |
where R: IntoSamplerust-analyzer cargo exr 1.74.0 image/IntoSample#, G: IntoSamplerust-analyzer cargo exr 1.74.0 image/IntoSample#, B: IntoSamplerust-analyzer cargo exr 1.74.0 image/IntoSample#, |
| 477 |
SampleStorage: GetPixelrust-analyzer cargo exr 1.74.0 image/write/channels/GetPixel#<Pixelrust-analyzer cargo exr 1.74.0 image/write/channels/GetPixel#Pixel#=(R, G, B)> |
| 478 |
{ |
| 479 |
SpecificChannelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels# { |
| 480 |
channelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#channels.: ( |
| 481 |
ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#::namedrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]named().("R", R::PREFERRED_SAMPLE_TYPErust-analyzer cargo exr 1.74.0 image/IntoSample#PREFERRED_SAMPLE_TYPE.), |
| 482 |
ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#::namedrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]named().("G", G::PREFERRED_SAMPLE_TYPErust-analyzer cargo exr 1.74.0 image/IntoSample#PREFERRED_SAMPLE_TYPE.), |
| 483 |
ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#::namedrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]named().("B", B::PREFERRED_SAMPLE_TYPErust-analyzer cargo exr 1.74.0 image/IntoSample#PREFERRED_SAMPLE_TYPE.), |
| 484 |
), |
| 485 |
pixelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#pixels.: source_samples |
| 486 |
} |
| 487 |
} |
| 488 |
} |
| 489 |
|
| 490 |
|
| 491 |
/// A list of samples representing a single pixel. |
| 492 |
/// Does not heap allocate for images with 8 or fewer channels. |
| 493 |
pub type FlatSamplesPixelrust-analyzer cargo exr 1.74.0 image/FlatSamplesPixel# = SmallVecrust-analyzer cargo smallvec 1.15.1 SmallVec#<[Samplerust-analyzer cargo exr 1.74.0 block/samples/Sample#; 8]>; |
| 494 |
|
| 495 |
// TODO also deep samples? |
| 496 |
impl Layerrust-analyzer cargo exr 1.74.0 image/Layer#<AnyChannelsrust-analyzer cargo exr 1.74.0 image/AnyChannels#<FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#>> { |
| 497 |
|
| 498 |
/// Use `samples_at` if you can borrow from this layer |
| 499 |
pub fn sample_vec_atrust-analyzer cargo exr 1.74.0 image/impl#[`Layer<AnyChannels<FlatSamples>>`]sample_vec_at().(&self, position: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<usize>) -> FlatSamplesPixelrust-analyzer cargo exr 1.74.0 image/FlatSamplesPixel# { |
| 500 |
self.samples_atrust-analyzer cargo exr 1.74.0 image/impl#[`Layer<AnyChannels<FlatSamples>>`]samples_at().(position).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().() |
| 501 |
} |
| 502 |
|
| 503 |
/// Lookup all channels of a single pixel in the image |
| 504 |
pub fn samples_atrust-analyzer cargo exr 1.74.0 image/impl#[`Layer<AnyChannels<FlatSamples>>`]samples_at().(&self, position: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<usize>) -> FlatSampleIteratorrust-analyzer cargo exr 1.74.0 image/FlatSampleIterator#<'_> { |
| 505 |
FlatSampleIteratorrust-analyzer cargo exr 1.74.0 image/FlatSampleIterator# { |
| 506 |
layerrust-analyzer cargo exr 1.74.0 image/FlatSampleIterator#layer.: self, |
| 507 |
channel_indexrust-analyzer cargo exr 1.74.0 image/FlatSampleIterator#channel_index.: 0, |
| 508 |
positionrust-analyzer cargo exr 1.74.0 image/FlatSampleIterator#position. |
| 509 |
} |
| 510 |
} |
| 511 |
} |
| 512 |
|
| 513 |
/// Iterate over all channels of a single pixel in the image |
| 514 |
#[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:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, 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:)] |
| 515 |
pub struct FlatSampleIteratorrust-analyzer cargo exr 1.74.0 image/FlatSampleIterator#<'s> { |
| 516 |
layerrust-analyzer cargo exr 1.74.0 image/FlatSampleIterator#layer.: &'s Layerrust-analyzer cargo exr 1.74.0 image/Layer#<AnyChannelsrust-analyzer cargo exr 1.74.0 image/AnyChannels#<FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#>>, |
| 517 |
channel_indexrust-analyzer cargo exr 1.74.0 image/FlatSampleIterator#channel_index.: usize, |
| 518 |
positionrust-analyzer cargo exr 1.74.0 image/FlatSampleIterator#position.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<usize>, |
| 519 |
} |
| 520 |
|
| 521 |
impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for FlatSampleIteratorrust-analyzer cargo exr 1.74.0 image/FlatSampleIterator#<'_> { |
| 522 |
type Itemrust-analyzer cargo exr 1.74.0 image/impl#[`FlatSampleIterator<'_>`][Iterator]Item# = Samplerust-analyzer cargo exr 1.74.0 block/samples/Sample#; |
| 523 |
|
| 524 |
fn nextrust-analyzer cargo exr 1.74.0 image/impl#[`FlatSampleIterator<'_>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo exr 1.74.0 image/impl#[`FlatSampleIterator<'_>`][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 525 |
if self.channel_indexrust-analyzer cargo exr 1.74.0 image/FlatSampleIterator#channel_index. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().self.layerrust-analyzer cargo exr 1.74.0 image/FlatSampleIterator#layer..channel_datarust-analyzer cargo exr 1.74.0 image/Layer#channel_data..listrust-analyzer cargo exr 1.74.0 image/AnyChannels#list..lenrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]len().() { |
| 526 |
let channel = &self.layerrust-analyzer cargo exr 1.74.0 image/FlatSampleIterator#layer..channel_datarust-analyzer cargo exr 1.74.0 image/Layer#channel_data..listrust-analyzer cargo exr 1.74.0 image/AnyChannels#list.[rust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`][`Index<I>`]index().self.channel_indexrust-analyzer cargo exr 1.74.0 image/FlatSampleIterator#channel_index.]rust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`][`Index<I>`]index().; |
| 527 |
let sample = channel.sample_datarust-analyzer cargo exr 1.74.0 image/AnyChannel#sample_data..value_by_flat_indexrust-analyzer cargo exr 1.74.0 image/impl#[FlatSamples]value_by_flat_index().(self.positionrust-analyzer cargo exr 1.74.0 image/FlatSampleIterator#position..flat_index_for_sizerust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]flat_index_for_size().(self.layerrust-analyzer cargo exr 1.74.0 image/FlatSampleIterator#layer..sizerust-analyzer cargo exr 1.74.0 image/Layer#size.)); |
| 528 |
self.channel_indexrust-analyzer cargo exr 1.74.0 image/FlatSampleIterator#channel_index. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 529 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(sample) |
| 530 |
} |
| 531 |
else { Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# } |
| 532 |
} |
| 533 |
|
| 534 |
fn nthrust-analyzer cargo exr 1.74.0 image/impl#[`FlatSampleIterator<'_>`][Iterator]nth().(&mut self, pos: usize) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo exr 1.74.0 image/impl#[`FlatSampleIterator<'_>`][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 535 |
self.channel_indexrust-analyzer cargo exr 1.74.0 image/FlatSampleIterator#channel_index. 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().pos; |
| 536 |
self.nextrust-analyzer cargo exr 1.74.0 image/impl#[`FlatSampleIterator<'_>`][Iterator]next().() |
| 537 |
} |
| 538 |
|
| 539 |
fn size_hintrust-analyzer cargo exr 1.74.0 image/impl#[`FlatSampleIterator<'_>`][Iterator]size_hint().(&self) -> (usize, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>) { |
| 540 |
let remaining = self.layerrust-analyzer cargo exr 1.74.0 image/FlatSampleIterator#layer..channel_datarust-analyzer cargo exr 1.74.0 image/Layer#channel_data..listrust-analyzer cargo exr 1.74.0 image/AnyChannels#list..lenrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]len().().saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]saturating_sub().(self.channel_indexrust-analyzer cargo exr 1.74.0 image/FlatSampleIterator#channel_index.); |
| 541 |
(remaining, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(remaining)) |
| 542 |
} |
| 543 |
} |
| 544 |
|
| 545 |
impl ExactSizeIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/exact_size/ExactSizeIterator# for FlatSampleIteratorrust-analyzer cargo exr 1.74.0 image/FlatSampleIterator#<'_> {} |
| 546 |
|
| 547 |
impl<SampleData> AnyChannelsrust-analyzer cargo exr 1.74.0 image/AnyChannels#<SampleData>{ |
| 548 |
|
| 549 |
/// A new list of arbitrary channels. Sorts the list to make it alphabetically stable. |
| 550 |
pub fn sortrust-analyzer cargo exr 1.74.0 image/impl#[`AnyChannels<SampleData>`]sort().(mut list: SmallVecrust-analyzer cargo smallvec 1.15.1 SmallVec#<[AnyChannelrust-analyzer cargo exr 1.74.0 image/AnyChannel#<SampleData>; 4]>) -> Selfrust-analyzer cargo exr 1.74.0 image/impl#[`AnyChannels<SampleData>`] { |
| 551 |
list.sort_unstable_by_keyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]sort_unstable_by_key().(|channel| channel.namerust-analyzer cargo exr 1.74.0 image/AnyChannel#name..clonerust-analyzer cargo exr 1.74.0 meta/attribute/impl#[Text][Clone]clone().()); // TODO no clone? |
| 552 |
Selfrust-analyzer cargo exr 1.74.0 image/impl#[`AnyChannels<SampleData>`] { listrust-analyzer cargo exr 1.74.0 image/AnyChannels#list. } |
| 553 |
} |
| 554 |
} |
| 555 |
|
| 556 |
// FIXME check content size of layer somewhere??? before writing? |
| 557 |
impl<LevelSamples> Levelsrust-analyzer cargo exr 1.74.0 image/Levels#<LevelSamples> { |
| 558 |
|
| 559 |
/// Get a resolution level by index, sorted by size, decreasing. |
| 560 |
pub fn get_levelrust-analyzer cargo exr 1.74.0 image/impl#[`Levels<LevelSamples>`]get_level().(&self, level: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<usize>) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<&LevelSamples> { |
| 561 |
match self { |
| 562 |
Levelsrust-analyzer cargo exr 1.74.0 image/Levels#::Singularrust-analyzer cargo exr 1.74.0 image/Levels#Singular#(block) => { |
| 563 |
debug_assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert_eq!!(level, Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(0,0), "singular image cannot write leveled blocks bug"); |
| 564 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(block) |
| 565 |
}, |
| 566 |
|
| 567 |
Levelsrust-analyzer cargo exr 1.74.0 image/Levels#::Miprust-analyzer cargo exr 1.74.0 image/Levels#Mip# { level_datarust-analyzer cargo exr 1.74.0 image/Levels#Mip#level_data., .. } => { |
| 568 |
debug_assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert_eq!!(level.xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().(), level.yrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]y().(), "mip map levels must be equal on x and y bug"); |
| 569 |
level_data.getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(level.xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().()).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().("block mip level index")) |
| 570 |
}, |
| 571 |
|
| 572 |
Levelsrust-analyzer cargo exr 1.74.0 image/Levels#::Riprust-analyzer cargo exr 1.74.0 image/Levels#Rip# { level_datarust-analyzer cargo exr 1.74.0 image/Levels#Rip#level_data., .. } => { |
| 573 |
level_data.get_by_levelrust-analyzer cargo exr 1.74.0 image/impl#[`RipMaps<Samples>`]get_by_level().(level).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().("block rip level index")) |
| 574 |
} |
| 575 |
} |
| 576 |
} |
| 577 |
|
| 578 |
/// Get a resolution level by index, sorted by size, decreasing. |
| 579 |
// TODO storage order for RIP maps? |
| 580 |
pub fn get_level_mutrust-analyzer cargo exr 1.74.0 image/impl#[`Levels<LevelSamples>`]get_level_mut().(&mut self, level: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<usize>) -> Resultrust-analyzer cargo exr 1.74.0 error/Result#<&mut LevelSamples> { |
| 581 |
match self { |
| 582 |
Levelsrust-analyzer cargo exr 1.74.0 image/Levels#::Singularrust-analyzer cargo exr 1.74.0 image/Levels#Singular#(ref mut block) => { |
| 583 |
debug_assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert_eq!!(level, Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(0,0), "singular image cannot write leveled blocks bug"); |
| 584 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(block) |
| 585 |
}, |
| 586 |
|
| 587 |
Levelsrust-analyzer cargo exr 1.74.0 image/Levels#::Miprust-analyzer cargo exr 1.74.0 image/Levels#Mip# { level_datarust-analyzer cargo exr 1.74.0 image/Levels#Mip#level_data., .. } => { |
| 588 |
debug_assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert_eq!!(level.xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().(), level.yrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]y().(), "mip map levels must be equal on x and y bug"); |
| 589 |
level_data.get_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get_mut().(level.xrust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]x().()).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().("block mip level index")) |
| 590 |
}, |
| 591 |
|
| 592 |
Levelsrust-analyzer cargo exr 1.74.0 image/Levels#::Riprust-analyzer cargo exr 1.74.0 image/Levels#Rip# { level_datarust-analyzer cargo exr 1.74.0 image/Levels#Rip#level_data., .. } => { |
| 593 |
level_data.get_by_level_mutrust-analyzer cargo exr 1.74.0 image/impl#[`RipMaps<Samples>`]get_by_level_mut().(level).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().("block rip level index")) |
| 594 |
} |
| 595 |
} |
| 596 |
} |
| 597 |
|
| 598 |
/// Get a slice of all resolution levels, sorted by size, decreasing. |
| 599 |
pub fn levels_as_slicerust-analyzer cargo exr 1.74.0 image/impl#[`Levels<LevelSamples>`]levels_as_slice().(&self) -> &[LevelSamples] { |
| 600 |
match self { |
| 601 |
Levelsrust-analyzer cargo exr 1.74.0 image/Levels#::Singularrust-analyzer cargo exr 1.74.0 image/Levels#Singular#(data) => stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/::from_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_ref().(data), |
| 602 |
Levelsrust-analyzer cargo exr 1.74.0 image/Levels#::Miprust-analyzer cargo exr 1.74.0 image/Levels#Mip# { level_datarust-analyzer cargo exr 1.74.0 image/Levels#Mip#level_data., .. } => level_data, |
| 603 |
Levelsrust-analyzer cargo exr 1.74.0 image/Levels#::Riprust-analyzer cargo exr 1.74.0 image/Levels#Rip# { level_datarust-analyzer cargo exr 1.74.0 image/Levels#Rip#level_data., .. } => &level_data.map_datarust-analyzer cargo exr 1.74.0 image/RipMaps#map_data., |
| 604 |
} |
| 605 |
} |
| 606 |
|
| 607 |
/// Get a mutable slice of all resolution levels, sorted by size, decreasing. |
| 608 |
pub fn levels_as_slice_mutrust-analyzer cargo exr 1.74.0 image/impl#[`Levels<LevelSamples>`]levels_as_slice_mut().(&mut self) -> &mut [LevelSamples] { |
| 609 |
match self { |
| 610 |
Levelsrust-analyzer cargo exr 1.74.0 image/Levels#::Singularrust-analyzer cargo exr 1.74.0 image/Levels#Singular#(data) => stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/::from_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_mut().(data), |
| 611 |
Levelsrust-analyzer cargo exr 1.74.0 image/Levels#::Miprust-analyzer cargo exr 1.74.0 image/Levels#Mip# { level_datarust-analyzer cargo exr 1.74.0 image/Levels#Mip#level_data., .. } => level_data, |
| 612 |
Levelsrust-analyzer cargo exr 1.74.0 image/Levels#::Riprust-analyzer cargo exr 1.74.0 image/Levels#Rip# { level_datarust-analyzer cargo exr 1.74.0 image/Levels#Rip#level_data., .. } => &mut level_data.map_datarust-analyzer cargo exr 1.74.0 image/RipMaps#map_data., |
| 613 |
} |
| 614 |
} |
| 615 |
|
| 616 |
// TODO simplify working with levels in general! like level_size_by_index and such |
| 617 |
|
| 618 |
/*pub fn levels_with_size(&self, rounding: RoundingMode, max_resolution: Vec2<usize>) -> Vec<(Vec2<usize>, &S)> { |
| 619 |
match self { |
| 620 |
Levels::Singular(ref data) => vec![ (max_resolution, data) ], |
| 621 |
Levels::Mip(ref maps) => mip_map_levels(rounding, max_resolution).map(|(_index, size)| size).zip(maps).collect(), |
| 622 |
Levels::Rip(ref rip_maps) => rip_map_levels(rounding, max_resolution).map(|(_index, size)| size).zip(&rip_maps.map_data).collect(), |
| 623 |
} |
| 624 |
}*/ |
| 625 |
|
| 626 |
/// Whether this stores multiple resolution levels. |
| 627 |
pub fn level_moderust-analyzer cargo exr 1.74.0 image/impl#[`Levels<LevelSamples>`]level_mode().(&self) -> LevelModerust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode# { |
| 628 |
match self { |
| 629 |
Levelsrust-analyzer cargo exr 1.74.0 image/Levels#::Singularrust-analyzer cargo exr 1.74.0 image/Levels#Singular#(_) => LevelModerust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#::Singularrust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#Singular#, |
| 630 |
Levelsrust-analyzer cargo exr 1.74.0 image/Levels#::Miprust-analyzer cargo exr 1.74.0 image/Levels#Mip# { .. } => LevelModerust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#::MipMaprust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#MipMap#, |
| 631 |
Levelsrust-analyzer cargo exr 1.74.0 image/Levels#::Riprust-analyzer cargo exr 1.74.0 image/Levels#Rip# { .. } => LevelModerust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#::RipMaprust-analyzer cargo exr 1.74.0 meta/attribute/LevelMode#RipMap#, |
| 632 |
} |
| 633 |
} |
| 634 |
} |
| 635 |
|
| 636 |
impl<Samples> RipMapsrust-analyzer cargo exr 1.74.0 image/RipMaps#<Samples> { |
| 637 |
|
| 638 |
/// Flatten the 2D level index to a one dimensional index. |
| 639 |
pub fn get_level_indexrust-analyzer cargo exr 1.74.0 image/impl#[`RipMaps<Samples>`]get_level_index().(&self, level: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<usize>) -> usize { |
| 640 |
level.flat_index_for_sizerust-analyzer cargo exr 1.74.0 math/impl#[`Vec2<T>`]flat_index_for_size().(self.level_countrust-analyzer cargo exr 1.74.0 image/RipMaps#level_count.) |
| 641 |
} |
| 642 |
|
| 643 |
/// Return a level by level index. Level `0` has the largest resolution. |
| 644 |
pub fn get_by_levelrust-analyzer cargo exr 1.74.0 image/impl#[`RipMaps<Samples>`]get_by_level().(&self, level: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<usize>) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&Samples> { |
| 645 |
self.map_datarust-analyzer cargo exr 1.74.0 image/RipMaps#map_data..getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(self.get_level_indexrust-analyzer cargo exr 1.74.0 image/impl#[`RipMaps<Samples>`]get_level_index().(level)) |
| 646 |
} |
| 647 |
|
| 648 |
/// Return a mutable level reference by level index. Level `0` has the largest resolution. |
| 649 |
pub fn get_by_level_mutrust-analyzer cargo exr 1.74.0 image/impl#[`RipMaps<Samples>`]get_by_level_mut().(&mut self, level: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<usize>) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&mut Samples> { |
| 650 |
let index = self.get_level_indexrust-analyzer cargo exr 1.74.0 image/impl#[`RipMaps<Samples>`]get_level_index().(level); |
| 651 |
self.map_datarust-analyzer cargo exr 1.74.0 image/RipMaps#map_data..get_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get_mut().(index) |
| 652 |
} |
| 653 |
} |
| 654 |
|
| 655 |
impl FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples# { |
| 656 |
|
| 657 |
/// The number of samples in the image. Should be the width times the height. |
| 658 |
/// Might vary when subsampling is used. |
| 659 |
pub fn lenrust-analyzer cargo exr 1.74.0 image/impl#[FlatSamples]len().(&self) -> usize { |
| 660 |
match self { |
| 661 |
FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#::F16rust-analyzer cargo exr 1.74.0 image/FlatSamples#F16#(vec) => vec.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), |
| 662 |
FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#::F32rust-analyzer cargo exr 1.74.0 image/FlatSamples#F32#(vec) => vec.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), |
| 663 |
FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#::U32rust-analyzer cargo exr 1.74.0 image/FlatSamples#U32#(vec) => vec.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), |
| 664 |
} |
| 665 |
} |
| 666 |
|
| 667 |
/// Views all samples in this storage as f32. |
| 668 |
/// Matches the underlying sample type again for every sample, |
| 669 |
/// match yourself if performance is critical! Does not allocate. |
| 670 |
pub fn values_as_f32rust-analyzer cargo exr 1.74.0 image/impl#[FlatSamples]values_as_f32().<'s>(&'s self) -> impl 's + 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# = f32> { |
| 671 |
self.valuesrust-analyzer cargo exr 1.74.0 image/impl#[FlatSamples]values().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|sample| sample.to_f32rust-analyzer cargo exr 1.74.0 block/samples/impl#[Sample]to_f32().()) |
| 672 |
} |
| 673 |
|
| 674 |
/// All samples in this storage as iterator. |
| 675 |
/// Matches the underlying sample type again for every sample, |
| 676 |
/// match yourself if performance is critical! Does not allocate. |
| 677 |
pub fn valuesrust-analyzer cargo exr 1.74.0 image/impl#[FlatSamples]values().<'s>(&'s self) -> impl 's + 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# = Samplerust-analyzer cargo exr 1.74.0 block/samples/Sample#> { |
| 678 |
(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#self.lenrust-analyzer cargo exr 1.74.0 image/impl#[FlatSamples]len().()).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(move |index| self.value_by_flat_indexrust-analyzer cargo exr 1.74.0 image/impl#[FlatSamples]value_by_flat_index().(index)) |
| 679 |
} |
| 680 |
|
| 681 |
/// Lookup a single value, by flat index. |
| 682 |
/// The flat index can be obtained using `Vec2::flatten_for_width` |
| 683 |
/// which computes the index in a flattened array of pixel rows. |
| 684 |
pub fn value_by_flat_indexrust-analyzer cargo exr 1.74.0 image/impl#[FlatSamples]value_by_flat_index().(&self, index: usize) -> Samplerust-analyzer cargo exr 1.74.0 block/samples/Sample# { |
| 685 |
match self { |
| 686 |
FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#::F16rust-analyzer cargo exr 1.74.0 image/FlatSamples#F16#(vec) => Samplerust-analyzer cargo exr 1.74.0 block/samples/Sample#::F16rust-analyzer cargo exr 1.74.0 block/samples/Sample#F16#(vec[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().index]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().), |
| 687 |
FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#::F32rust-analyzer cargo exr 1.74.0 image/FlatSamples#F32#(vec) => Samplerust-analyzer cargo exr 1.74.0 block/samples/Sample#::F32rust-analyzer cargo exr 1.74.0 block/samples/Sample#F32#(vec[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().index]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().), |
| 688 |
FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#::U32rust-analyzer cargo exr 1.74.0 image/FlatSamples#U32#(vec) => Samplerust-analyzer cargo exr 1.74.0 block/samples/Sample#::U32rust-analyzer cargo exr 1.74.0 block/samples/Sample#U32#(vec[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().index]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().), |
| 689 |
} |
| 690 |
} |
| 691 |
} |
| 692 |
|
| 693 |
|
| 694 |
impl<'s, ChannelData:'s> Layerrust-analyzer cargo exr 1.74.0 image/Layer#<ChannelData> { |
| 695 |
|
| 696 |
/// Create a layer with the specified size, attributes, encoding and channels. |
| 697 |
/// The channels can be either `SpecificChannels` or `AnyChannels`. |
| 698 |
pub fn newrust-analyzer cargo exr 1.74.0 image/impl#[`Layer<ChannelData>`]new().( |
| 699 |
dimensions: 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>>, |
| 700 |
attributes: LayerAttributesrust-analyzer cargo exr 1.74.0 meta/header/LayerAttributes#, |
| 701 |
encoding: Encodingrust-analyzer cargo exr 1.74.0 image/Encoding#, |
| 702 |
channels: ChannelData |
| 703 |
) -> Selfrust-analyzer cargo exr 1.74.0 image/impl#[`Layer<ChannelData>`] |
| 704 |
where ChannelData: WritableChannelsrust-analyzer cargo exr 1.74.0 image/write/channels/WritableChannels#<'s> |
| 705 |
{ |
| 706 |
Layerrust-analyzer cargo exr 1.74.0 image/Layer# { channel_datarust-analyzer cargo exr 1.74.0 image/Layer#channel_data.: channels, attributesrust-analyzer cargo exr 1.74.0 image/Layer#attributes., sizerust-analyzer cargo exr 1.74.0 image/Layer#size.: dimensions.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().(), encodingrust-analyzer cargo exr 1.74.0 image/Layer#encoding. } |
| 707 |
} |
| 708 |
|
| 709 |
// TODO test pls wtf |
| 710 |
/// Panics for images with Scanline encoding. |
| 711 |
pub fn levels_with_resolutionrust-analyzer cargo exr 1.74.0 image/impl#[`Layer<ChannelData>`]levels_with_resolution().<'l, L>(&self, levels: &'l Levelsrust-analyzer cargo exr 1.74.0 image/Levels#<L>) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn 'l + 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#=(&'l L, Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#<usize>)>> { |
| 712 |
match levels { |
| 713 |
Levelsrust-analyzer cargo exr 1.74.0 image/Levels#::Singularrust-analyzer cargo exr 1.74.0 image/Levels#Singular#(level) => Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(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/::oncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/once/once().((level, self.sizerust-analyzer cargo exr 1.74.0 image/Layer#size.))), |
| 714 |
|
| 715 |
Levelsrust-analyzer cargo exr 1.74.0 image/Levels#::Miprust-analyzer cargo exr 1.74.0 image/Levels#Mip# { rounding_moderust-analyzer cargo exr 1.74.0 image/Levels#Mip#rounding_mode., level_datarust-analyzer cargo exr 1.74.0 image/Levels#Mip#level_data. } => Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(level_data.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().( |
| 716 |
mip_map_levelsrust-analyzer cargo exr 1.74.0 meta/mip_map_levels().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().rounding_mode, self.sizerust-analyzer cargo exr 1.74.0 image/Layer#size.) |
| 717 |
.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(_index, size)| size) |
| 718 |
)), |
| 719 |
|
| 720 |
Levelsrust-analyzer cargo exr 1.74.0 image/Levels#::Riprust-analyzer cargo exr 1.74.0 image/Levels#Rip# { rounding_moderust-analyzer cargo exr 1.74.0 image/Levels#Rip#rounding_mode., level_datarust-analyzer cargo exr 1.74.0 image/Levels#Rip#level_data. } => Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(level_data.map_datarust-analyzer cargo exr 1.74.0 image/RipMaps#map_data..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().( |
| 721 |
rip_map_levelsrust-analyzer cargo exr 1.74.0 meta/rip_map_levels().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().rounding_mode, self.sizerust-analyzer cargo exr 1.74.0 image/Layer#size.) |
| 722 |
.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(_index, size)| size) |
| 723 |
)), |
| 724 |
} |
| 725 |
} |
| 726 |
} |
| 727 |
|
| 728 |
impl Encodingrust-analyzer cargo exr 1.74.0 image/Encoding# { |
| 729 |
|
| 730 |
/// No compression. Massive space requirements. |
| 731 |
/// Fast, because it minimizes data shuffling and reallocation. |
| 732 |
pub const UNCOMPRESSEDrust-analyzer cargo exr 1.74.0 image/impl#[Encoding]UNCOMPRESSED.: Encodingrust-analyzer cargo exr 1.74.0 image/Encoding# = Encodingrust-analyzer cargo exr 1.74.0 image/Encoding# { |
| 733 |
compressionrust-analyzer cargo exr 1.74.0 image/Encoding#compression.: Compressionrust-analyzer cargo exr 1.74.0 compression/Compression#::Uncompressedrust-analyzer cargo exr 1.74.0 compression/Compression#Uncompressed#, |
| 734 |
blocksrust-analyzer cargo exr 1.74.0 image/Encoding#blocks.: Blocksrust-analyzer cargo exr 1.74.0 image/Blocks#::ScanLinesrust-analyzer cargo exr 1.74.0 image/Blocks#ScanLines#, // longest lines, faster memcpy |
| 735 |
line_orderrust-analyzer cargo exr 1.74.0 image/Encoding#line_order.: LineOrderrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#::Increasingrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#Increasing# // presumably fastest? |
| 736 |
}; |
| 737 |
|
| 738 |
/// Run-length encoding with tiles of 64x64 pixels. This is the recommended default encoding. |
| 739 |
/// Almost as fast as uncompressed data, but optimizes single-colored areas such as mattes and masks. |
| 740 |
pub const FAST_LOSSLESSrust-analyzer cargo exr 1.74.0 image/impl#[Encoding]FAST_LOSSLESS.: Encodingrust-analyzer cargo exr 1.74.0 image/Encoding# = Encodingrust-analyzer cargo exr 1.74.0 image/Encoding# { |
| 741 |
compressionrust-analyzer cargo exr 1.74.0 image/Encoding#compression.: Compressionrust-analyzer cargo exr 1.74.0 compression/Compression#::RLErust-analyzer cargo exr 1.74.0 compression/Compression#RLE#, |
| 742 |
blocksrust-analyzer cargo exr 1.74.0 image/Encoding#blocks.: Blocksrust-analyzer cargo exr 1.74.0 image/Blocks#::Tilesrust-analyzer cargo exr 1.74.0 image/Blocks#Tiles#(Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(64, 64)), // optimize for RLE compression |
| 743 |
line_orderrust-analyzer cargo exr 1.74.0 image/Encoding#line_order.: LineOrderrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#::Unspecifiedrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#Unspecified# |
| 744 |
}; |
| 745 |
|
| 746 |
/// ZIP compression with blocks of 16 lines. Slow, but produces small files without visible artefacts. |
| 747 |
pub const SMALL_LOSSLESSrust-analyzer cargo exr 1.74.0 image/impl#[Encoding]SMALL_LOSSLESS.: Encodingrust-analyzer cargo exr 1.74.0 image/Encoding# = Encodingrust-analyzer cargo exr 1.74.0 image/Encoding# { |
| 748 |
compressionrust-analyzer cargo exr 1.74.0 image/Encoding#compression.: Compressionrust-analyzer cargo exr 1.74.0 compression/Compression#::ZIP16rust-analyzer cargo exr 1.74.0 compression/Compression#ZIP16#, |
| 749 |
blocksrust-analyzer cargo exr 1.74.0 image/Encoding#blocks.: Blocksrust-analyzer cargo exr 1.74.0 image/Blocks#::ScanLinesrust-analyzer cargo exr 1.74.0 image/Blocks#ScanLines#, // largest possible, but also with high probability of parallel workers |
| 750 |
line_orderrust-analyzer cargo exr 1.74.0 image/Encoding#line_order.: LineOrderrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#::Increasingrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#Increasing# |
| 751 |
}; |
| 752 |
|
| 753 |
/// PIZ compression with tiles of 256x256 pixels. Small images, not too slow. |
| 754 |
pub const SMALL_FAST_LOSSLESSrust-analyzer cargo exr 1.74.0 image/impl#[Encoding]SMALL_FAST_LOSSLESS.: Encodingrust-analyzer cargo exr 1.74.0 image/Encoding# = Encodingrust-analyzer cargo exr 1.74.0 image/Encoding# { |
| 755 |
compressionrust-analyzer cargo exr 1.74.0 image/Encoding#compression.: Compressionrust-analyzer cargo exr 1.74.0 compression/Compression#::PIZrust-analyzer cargo exr 1.74.0 compression/Compression#PIZ#, |
| 756 |
blocksrust-analyzer cargo exr 1.74.0 image/Encoding#blocks.: Blocksrust-analyzer cargo exr 1.74.0 image/Blocks#::Tilesrust-analyzer cargo exr 1.74.0 image/Blocks#Tiles#(Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(256, 256)), |
| 757 |
line_orderrust-analyzer cargo exr 1.74.0 image/Encoding#line_order.: LineOrderrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#::Unspecifiedrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#Unspecified# |
| 758 |
}; |
| 759 |
} |
| 760 |
|
| 761 |
impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for Encodingrust-analyzer cargo exr 1.74.0 image/Encoding# { |
| 762 |
fn defaultrust-analyzer cargo exr 1.74.0 image/impl#[Encoding][Default]default().() -> Selfrust-analyzer cargo exr 1.74.0 image/impl#[Encoding][Default] { Encodingrust-analyzer cargo exr 1.74.0 image/Encoding#::FAST_LOSSLESSrust-analyzer cargo exr 1.74.0 image/impl#[Encoding]FAST_LOSSLESS. } |
| 763 |
} |
| 764 |
|
| 765 |
impl<'s, LayerData: 's> Imagerust-analyzer cargo exr 1.74.0 image/Image#<LayerData> where LayerData: WritableLayersrust-analyzer cargo exr 1.74.0 image/write/layers/WritableLayers#<'s> { |
| 766 |
/// Create an image with one or multiple layers. The layer can be a `Layer`, or `Layers` small vector, or `Vec<Layer>` or `&[Layer]`. |
| 767 |
pub fn newrust-analyzer cargo exr 1.74.0 image/impl#[`Image<LayerData>`]new().(image_attributes: ImageAttributesrust-analyzer cargo exr 1.74.0 meta/header/ImageAttributes#, layer_data: LayerData) -> Selfrust-analyzer cargo exr 1.74.0 image/impl#[`Image<LayerData>`] { |
| 768 |
Imagerust-analyzer cargo exr 1.74.0 image/Image# { attributesrust-analyzer cargo exr 1.74.0 image/Image#attributes.: image_attributes, layer_datarust-analyzer cargo exr 1.74.0 image/Image#layer_data. } |
| 769 |
} |
| 770 |
} |
| 771 |
|
| 772 |
// explorable constructor alias |
| 773 |
impl<'s, Channels: 's> Imagerust-analyzer cargo exr 1.74.0 image/Image#<Layersrust-analyzer cargo exr 1.74.0 image/Layers#<Channels>> where Channels: WritableChannelsrust-analyzer cargo exr 1.74.0 image/write/channels/WritableChannels#<'s> { |
| 774 |
/// Create an image with multiple layers. The layer can be a `Vec<Layer>` or `Layers` (a small vector). |
| 775 |
pub fn from_layersrust-analyzer cargo exr 1.74.0 image/impl#[`Image<SmallVec<[Layer<Channels>; 2]>>`]from_layers().(image_attributes: ImageAttributesrust-analyzer cargo exr 1.74.0 meta/header/ImageAttributes#, layer_data: impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Layersrust-analyzer cargo exr 1.74.0 image/Layers#<Channels>>) -> Selfrust-analyzer cargo exr 1.74.0 image/impl#[`Image<SmallVec<[Layer<Channels>; 2]>>`] { |
| 776 |
Selfrust-analyzer cargo exr 1.74.0 image/impl#[`Image<SmallVec<[Layer<Channels>; 2]>>`]::newrust-analyzer cargo exr 1.74.0 image/impl#[`Image<LayerData>`]new().(image_attributes, layer_data.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().()) |
| 777 |
} |
| 778 |
} |
| 779 |
|
| 780 |
|
| 781 |
impl<'s, ChannelData:'s> Imagerust-analyzer cargo exr 1.74.0 image/Image#<Layerrust-analyzer cargo exr 1.74.0 image/Layer#<ChannelData>> where ChannelData: WritableChannelsrust-analyzer cargo exr 1.74.0 image/write/channels/WritableChannels#<'s> { |
| 782 |
|
| 783 |
/// Uses the display position and size to the channel position and size of the layer. |
| 784 |
pub fn from_layerrust-analyzer cargo exr 1.74.0 image/impl#[`Image<Layer<ChannelData>>`]from_layer().(layer: Layerrust-analyzer cargo exr 1.74.0 image/Layer#<ChannelData>) -> Selfrust-analyzer cargo exr 1.74.0 image/impl#[`Image<Layer<ChannelData>>`] { |
| 785 |
let bounds = IntegerBoundsrust-analyzer cargo exr 1.74.0 meta/attribute/IntegerBounds#::newrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[IntegerBounds]new().(layer.attributesrust-analyzer cargo exr 1.74.0 image/Layer#attributes..layer_positionrust-analyzer cargo exr 1.74.0 meta/header/LayerAttributes#layer_position., layer.sizerust-analyzer cargo exr 1.74.0 image/Layer#size.); |
| 786 |
Selfrust-analyzer cargo exr 1.74.0 image/impl#[`Image<Layer<ChannelData>>`]::newrust-analyzer cargo exr 1.74.0 image/impl#[`Image<LayerData>`]new().(ImageAttributesrust-analyzer cargo exr 1.74.0 meta/header/ImageAttributes#::newrust-analyzer cargo exr 1.74.0 meta/header/impl#[ImageAttributes]new().(bounds), layer) |
| 787 |
} |
| 788 |
|
| 789 |
/// Uses empty attributes. |
| 790 |
pub fn from_encoded_channelsrust-analyzer cargo exr 1.74.0 image/impl#[`Image<Layer<ChannelData>>`]from_encoded_channels().(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>>, encoding: Encodingrust-analyzer cargo exr 1.74.0 image/Encoding#, channels: ChannelData) -> Selfrust-analyzer cargo exr 1.74.0 image/impl#[`Image<Layer<ChannelData>>`] { |
| 791 |
// layer name is not required for single-layer images |
| 792 |
Selfrust-analyzer cargo exr 1.74.0 image/impl#[`Image<Layer<ChannelData>>`]::from_layerrust-analyzer cargo exr 1.74.0 image/impl#[`Image<Layer<ChannelData>>`]from_layer().(Layerrust-analyzer cargo exr 1.74.0 image/Layer#::newrust-analyzer cargo exr 1.74.0 image/impl#[`Layer<ChannelData>`]new().(size, LayerAttributesrust-analyzer cargo exr 1.74.0 meta/header/LayerAttributes#::defaultrust-analyzer cargo exr 1.74.0 meta/header/impl#[LayerAttributes][Default]default().(), encoding, channels)) |
| 793 |
} |
| 794 |
|
| 795 |
/// Uses empty attributes and fast compression. |
| 796 |
pub fn from_channelsrust-analyzer cargo exr 1.74.0 image/impl#[`Image<Layer<ChannelData>>`]from_channels().(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>>, channels: ChannelData) -> Selfrust-analyzer cargo exr 1.74.0 image/impl#[`Image<Layer<ChannelData>>`] { |
| 797 |
Selfrust-analyzer cargo exr 1.74.0 image/impl#[`Image<Layer<ChannelData>>`]::from_encoded_channelsrust-analyzer cargo exr 1.74.0 image/impl#[`Image<Layer<ChannelData>>`]from_encoded_channels().(size, Encodingrust-analyzer cargo exr 1.74.0 image/Encoding#::defaultrust-analyzer cargo exr 1.74.0 image/impl#[Encoding][Default]default().(), channels) |
| 798 |
} |
| 799 |
} |
| 800 |
|
| 801 |
|
| 802 |
impl Imagerust-analyzer cargo exr 1.74.0 image/Image#<NoneMorerust-analyzer cargo exr 1.74.0 image/recursive/NoneMore#> { |
| 803 |
|
| 804 |
/// Create an empty image, to be filled with layers later on. Add at least one layer to obtain a valid image. |
| 805 |
/// Call `with_layer(another_layer)` for each layer you want to add to this image. |
| 806 |
pub fn emptyrust-analyzer cargo exr 1.74.0 image/impl#[`Image<NoneMore>`]empty().(attributes: ImageAttributesrust-analyzer cargo exr 1.74.0 meta/header/ImageAttributes#) -> Selfrust-analyzer cargo exr 1.74.0 image/impl#[`Image<NoneMore>`] { Selfrust-analyzer cargo exr 1.74.0 image/impl#[`Image<NoneMore>`] { attributesrust-analyzer cargo exr 1.74.0 image/Image#attributes., layer_datarust-analyzer cargo exr 1.74.0 image/Image#layer_data.: NoneMorerust-analyzer cargo exr 1.74.0 image/recursive/NoneMore# } } |
| 807 |
} |
| 808 |
|
| 809 |
impl<'s, InnerLayers: 's> Imagerust-analyzer cargo exr 1.74.0 image/Image#<InnerLayers> where |
| 810 |
InnerLayers: WritableLayersrust-analyzer cargo exr 1.74.0 image/write/layers/WritableLayers#<'s>, |
| 811 |
{ |
| 812 |
/// Add another layer to this image. The layer type does |
| 813 |
/// not have to equal the existing layers in this image. |
| 814 |
pub fn with_layerrust-analyzer cargo exr 1.74.0 image/impl#[`Image<InnerLayers>`]with_layer().<NewChannels>(self, layer: Layerrust-analyzer cargo exr 1.74.0 image/Layer#<NewChannels>) |
| 815 |
-> Imagerust-analyzer cargo exr 1.74.0 image/Image#<Recursiverust-analyzer cargo exr 1.74.0 image/recursive/Recursive#<InnerLayers, Layerrust-analyzer cargo exr 1.74.0 image/Layer#<NewChannels>>> |
| 816 |
where NewChannels: 's + WritableChannelsrust-analyzer cargo exr 1.74.0 image/write/channels/WritableChannels#<'s> |
| 817 |
{ |
| 818 |
Imagerust-analyzer cargo exr 1.74.0 image/Image# { |
| 819 |
attributesrust-analyzer cargo exr 1.74.0 image/Image#attributes.: self.attributesrust-analyzer cargo exr 1.74.0 image/Image#attributes., |
| 820 |
layer_datarust-analyzer cargo exr 1.74.0 image/Image#layer_data.: Recursiverust-analyzer cargo exr 1.74.0 image/recursive/Recursive#::newrust-analyzer cargo exr 1.74.0 image/recursive/impl#[`Recursive<Inner, Value>`]new().(self.layer_datarust-analyzer cargo exr 1.74.0 image/Image#layer_data., layer) |
| 821 |
} |
| 822 |
} |
| 823 |
} |
| 824 |
|
| 825 |
|
| 826 |
impl<'s, SampleData: 's> AnyChannelrust-analyzer cargo exr 1.74.0 image/AnyChannel#<SampleData> { |
| 827 |
|
| 828 |
/// Create a new channel without subsampling. |
| 829 |
/// |
| 830 |
/// Automatically flags this channel for specialized compression |
| 831 |
/// if the name is "R", "G", "B", "Y", or "L", |
| 832 |
/// as they typically encode values that are perceived non-linearly. |
| 833 |
/// Construct the value yourself using `AnyChannel { .. }`, if you want to control this flag. |
| 834 |
pub fn newrust-analyzer cargo exr 1.74.0 image/impl#[`AnyChannel<SampleData>`]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_data: SampleData) -> Selfrust-analyzer cargo exr 1.74.0 image/impl#[`AnyChannel<SampleData>`] where SampleData: WritableSamplesrust-analyzer cargo exr 1.74.0 image/write/samples/WritableSamples#<'s> { |
| 835 |
let name: Textrust-analyzer cargo exr 1.74.0 meta/attribute/Text# = name.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().(); |
| 836 |
|
| 837 |
AnyChannelrust-analyzer cargo exr 1.74.0 image/AnyChannel# { |
| 838 |
quantize_linearlyrust-analyzer cargo exr 1.74.0 image/AnyChannel#quantize_linearly.: ChannelDescriptionrust-analyzer cargo exr 1.74.0 meta/attribute/ChannelDescription#::guess_quantization_linearityrust-analyzer cargo exr 1.74.0 meta/attribute/impl#[ChannelDescription]guess_quantization_linearity().(&name), |
| 839 |
namerust-analyzer cargo exr 1.74.0 image/AnyChannel#name., sample_datarust-analyzer cargo exr 1.74.0 image/AnyChannel#sample_data., |
| 840 |
samplingrust-analyzer cargo exr 1.74.0 image/AnyChannel#sampling.: Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(1, 1), |
| 841 |
} |
| 842 |
} |
| 843 |
|
| 844 |
/*/// This is the same as `AnyChannel::new()`, but additionally ensures that the closure type is correct. |
| 845 |
pub fn from_closure<V>(name: Text, sample_data: S) -> Self |
| 846 |
where S: Sync + Fn(Vec2<usize>) -> V, V: InferSampleType + Data |
| 847 |
{ |
| 848 |
Self::new(name, sample_data) |
| 849 |
}*/ |
| 850 |
} |
| 851 |
|
| 852 |
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 FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples# { |
| 853 |
fn fmtrust-analyzer cargo exr 1.74.0 image/impl#[FlatSamples][Debug]fmt().(&self, formatter: &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# { |
| 854 |
if self.lenrust-analyzer cargo exr 1.74.0 image/impl#[FlatSamples]len().() 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().6 { |
| 855 |
match self { |
| 856 |
FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#::F16rust-analyzer cargo exr 1.74.0 image/FlatSamples#F16#(vec) => vec.fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Debug]fmt().(formatter), |
| 857 |
FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#::F32rust-analyzer cargo exr 1.74.0 image/FlatSamples#F32#(vec) => vec.fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Debug]fmt().(formatter), |
| 858 |
FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#::U32rust-analyzer cargo exr 1.74.0 image/FlatSamples#U32#(vec) => vec.fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Debug]fmt().(formatter), |
| 859 |
} |
| 860 |
} |
| 861 |
else { |
| 862 |
match self { |
| 863 |
FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#::F16rust-analyzer cargo exr 1.74.0 image/FlatSamples#F16#(vec) => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(formatter, "[f16; {}]", vec.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().()), |
| 864 |
FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#::F32rust-analyzer cargo exr 1.74.0 image/FlatSamples#F32#(vec) => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(formatter, "[f32; {}]", vec.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().()), |
| 865 |
FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#::U32rust-analyzer cargo exr 1.74.0 image/FlatSamples#U32#(vec) => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(formatter, "[u32; {}]", vec.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().()), |
| 866 |
} |
| 867 |
} |
| 868 |
} |
| 869 |
} |
| 870 |
|
| 871 |
|
| 872 |
|
| 873 |
/// Compare the result of a round trip test with the original method. |
| 874 |
/// Supports lossy compression methods. |
| 875 |
// #[cfg(test)] TODO do not ship this code |
| 876 |
pub mod validate_resultsrust-analyzer cargo exr 1.74.0 image/validate_results/ { |
| 877 |
use craterust-analyzer cargo exr 1.74.0 crate/::preluderust-analyzer cargo exr 1.74.0 prelude/::*; |
| 878 |
use smallvecrust-analyzer cargo smallvec 1.15.1 crate/::Arrayrust-analyzer cargo smallvec 1.15.1 Array#; |
| 879 |
use craterust-analyzer cargo exr 1.74.0 crate/::preluderust-analyzer cargo exr 1.74.0 prelude/::recursiverust-analyzer cargo exr 1.74.0 image/recursive/::*; |
| 880 |
use craterust-analyzer cargo exr 1.74.0 crate/::imagerust-analyzer cargo exr 1.74.0 image/::writerust-analyzer cargo exr 1.74.0 image/write/::samplesrust-analyzer cargo exr 1.74.0 image/write/samples/::WritableSamplesrust-analyzer cargo exr 1.74.0 image/write/samples/WritableSamples#; |
| 881 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Notrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/Not#; |
| 882 |
use craterust-analyzer cargo exr 1.74.0 crate/::blockrust-analyzer cargo exr 1.74.0 block/::samplesrust-analyzer cargo exr 1.74.0 block/samples/::IntoNativeSamplerust-analyzer cargo exr 1.74.0 block/samples/IntoNativeSample#; |
| 883 |
|
| 884 |
/// Compare two objects, but with a few special quirks. |
| 885 |
/// Intended mainly for unit testing. |
| 886 |
pub trait ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# { |
| 887 |
|
| 888 |
/// Compare self with the other. Panics if not equal. |
| 889 |
/// |
| 890 |
/// Exceptional behaviour: |
| 891 |
/// This does not work the other way around! This method is not symmetrical! |
| 892 |
/// Returns whether the result is correct for this image. |
| 893 |
/// For lossy compression methods, uses approximate equality. |
| 894 |
/// Intended for unit testing. |
| 895 |
/// |
| 896 |
/// Warning: If you use `SpecificChannels`, the comparison might be inaccurate |
| 897 |
/// for images with mixed compression methods. This is to be used with `AnyChannels` mainly. |
| 898 |
fn assert_equals_resultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#assert_equals_result().(&self, result: &Self) { |
| 899 |
self.validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#validate_result().(result, ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#::defaultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[ValidationOptions][Default]default().(), || Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 900 |
} |
| 901 |
|
| 902 |
/// Compare self with the other. |
| 903 |
/// Exceptional behaviour: |
| 904 |
/// - Any two NaN values are considered equal, regardless of bit representation. |
| 905 |
/// - If a `lossy` is specified, any two values that differ only by a small amount will be considered equal. |
| 906 |
/// - If `nan_to_zero` is true, and __self is NaN/Infinite and the other value is zero, they are considered equal__ |
| 907 |
/// (because some compression methods replace nan with zero) |
| 908 |
/// |
| 909 |
/// This does not work the other way around! This method is not symmetrical! |
| 910 |
fn validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#validate_result().( |
| 911 |
&self, lossy_result: &Self, |
| 912 |
options: ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#, |
| 913 |
// this is a lazy string, because constructing a string is only necessary in the case of an error, |
| 914 |
// but eats up memory and allocation time every time. this was measured. |
| 915 |
context: impl Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#() -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# |
| 916 |
) -> ValidationResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationResult#; |
| 917 |
} |
| 918 |
|
| 919 |
/// Whether to do accurate or approximate comparison. |
| 920 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, 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:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 921 |
pub struct ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions# { |
| 922 |
allow_lossyrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#allow_lossy.: bool, |
| 923 |
nan_converted_to_zerorust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#nan_converted_to_zero.: bool, |
| 924 |
} |
| 925 |
|
| 926 |
/// If invalid, contains the error message. |
| 927 |
pub type ValidationResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationResult# = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>; |
| 928 |
|
| 929 |
|
| 930 |
impl<C> ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# for Imagerust-analyzer cargo exr 1.74.0 image/Image#<C> where C: ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# { |
| 931 |
fn validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`Image<C>`][ValidateResult]validate_result().(&self, other: &Selfrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`Image<C>`][ValidateResult], options: ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#, location: impl Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#()->Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> ValidationResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationResult# { |
| 932 |
if self.attributesrust-analyzer cargo exr 1.74.0 image/Image#attributes. 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().other.attributesrust-analyzer cargo exr 1.74.0 image/Image#attributes. { Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(location() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add()."| image > attributes") } |
| 933 |
else { self.layer_datarust-analyzer cargo exr 1.74.0 image/Image#layer_data..validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#validate_result().(&other.layer_datarust-analyzer cargo exr 1.74.0 image/Image#layer_data., options, || location() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add()."| image > layer data") } |
| 934 |
} |
| 935 |
} |
| 936 |
|
| 937 |
impl<S> ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# for Layerrust-analyzer cargo exr 1.74.0 image/Layer#<AnyChannelsrust-analyzer cargo exr 1.74.0 image/AnyChannels#<S>> |
| 938 |
where AnyChannelrust-analyzer cargo exr 1.74.0 image/AnyChannel#<S>: ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#, S: for<'a> WritableSamplesrust-analyzer cargo exr 1.74.0 image/write/samples/WritableSamples#<'a> |
| 939 |
{ |
| 940 |
fn validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`Layer<AnyChannels<S>>`][ValidateResult]validate_result().(&self, other: &Selfrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`Layer<AnyChannels<S>>`][ValidateResult], _overridden: ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#, location: impl Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#()->Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> ValidationResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationResult# { |
| 941 |
let location = || formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{} (layer `{:?}`)", location(), self.attributesrust-analyzer cargo exr 1.74.0 image/Layer#attributes..layer_namerust-analyzer cargo exr 1.74.0 meta/header/LayerAttributes#layer_name.); |
| 942 |
if self.attributesrust-analyzer cargo exr 1.74.0 image/Layer#attributes. 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().other.attributesrust-analyzer cargo exr 1.74.0 image/Layer#attributes. { Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(location() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add()." > attributes") } |
| 943 |
else if self.encodingrust-analyzer cargo exr 1.74.0 image/Layer#encoding. 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().other.encodingrust-analyzer cargo exr 1.74.0 image/Layer#encoding. { Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(location() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add()." > encoding") } |
| 944 |
else if self.sizerust-analyzer cargo exr 1.74.0 image/Layer#size. 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().other.sizerust-analyzer cargo exr 1.74.0 image/Layer#size. { Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(location() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add()." > size") } |
| 945 |
else if self.channel_datarust-analyzer cargo exr 1.74.0 image/Layer#channel_data..listrust-analyzer cargo exr 1.74.0 image/AnyChannels#list..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][`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().other.channel_datarust-analyzer cargo exr 1.74.0 image/Layer#channel_data..listrust-analyzer cargo exr 1.74.0 image/AnyChannels#list..lenrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]len().() { Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(location() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add()." > channel count") } |
| 946 |
else { |
| 947 |
for (own_chan, other_chan) in self.channel_datarust-analyzer cargo exr 1.74.0 image/Layer#channel_data..listrust-analyzer cargo exr 1.74.0 image/AnyChannels#list..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(other.channel_datarust-analyzer cargo exr 1.74.0 image/Layer#channel_data..listrust-analyzer cargo exr 1.74.0 image/AnyChannels#list..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()) { |
| 948 |
own_chan.validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#validate_result().( |
| 949 |
other_chan, |
| 950 |
|
| 951 |
ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions# { |
| 952 |
// no tolerance for lossless channels |
| 953 |
allow_lossyrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#allow_lossy.: other.encodingrust-analyzer cargo exr 1.74.0 image/Layer#encoding..compressionrust-analyzer cargo exr 1.74.0 image/Encoding#compression. |
| 954 |
.is_lossless_forrust-analyzer cargo exr 1.74.0 compression/impl#[Compression]is_lossless_for().(other_chan.sample_datarust-analyzer cargo exr 1.74.0 image/AnyChannel#sample_data..sample_typerust-analyzer cargo exr 1.74.0 image/write/samples/WritableSamples#sample_type().()).notrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().(), |
| 955 |
|
| 956 |
// consider nan and zero equal if the compression method does not support nan |
| 957 |
nan_converted_to_zerorust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#nan_converted_to_zero.: other.encodingrust-analyzer cargo exr 1.74.0 image/Layer#encoding..compressionrust-analyzer cargo exr 1.74.0 image/Encoding#compression..supports_nanrust-analyzer cargo exr 1.74.0 compression/impl#[Compression]supports_nan().().notrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().() |
| 958 |
}, |
| 959 |
|
| 960 |
|| formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{} > channel `{}`", location(), own_chan.namerust-analyzer cargo exr 1.74.0 image/AnyChannel#name.) |
| 961 |
)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 962 |
} |
| 963 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 964 |
} |
| 965 |
} |
| 966 |
} |
| 967 |
|
| 968 |
impl<Px, Desc> ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# for Layerrust-analyzer cargo exr 1.74.0 image/Layer#<SpecificChannelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#<Px, Desc>> |
| 969 |
where SpecificChannelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#<Px, Desc>: ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# |
| 970 |
{ |
| 971 |
/// This does an approximate comparison for all channels, |
| 972 |
/// even if some channels can be compressed without loss. |
| 973 |
fn validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`Layer<SpecificChannels<Px, Desc>>`][ValidateResult]validate_result().(&self, other: &Selfrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`Layer<SpecificChannels<Px, Desc>>`][ValidateResult], _overridden: ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#, location: impl Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#()->Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> ValidationResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationResult# { |
| 974 |
let location = || formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{} (layer `{:?}`)", location(), self.attributesrust-analyzer cargo exr 1.74.0 image/Layer#attributes..layer_namerust-analyzer cargo exr 1.74.0 meta/header/LayerAttributes#layer_name.); |
| 975 |
|
| 976 |
// TODO dedup with above |
| 977 |
if self.attributesrust-analyzer cargo exr 1.74.0 image/Layer#attributes. 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().other.attributesrust-analyzer cargo exr 1.74.0 image/Layer#attributes. { Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(location() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add()." > attributes") } |
| 978 |
else if self.encodingrust-analyzer cargo exr 1.74.0 image/Layer#encoding. 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().other.encodingrust-analyzer cargo exr 1.74.0 image/Layer#encoding. { Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(location() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add()." > encoding") } |
| 979 |
else if self.sizerust-analyzer cargo exr 1.74.0 image/Layer#size. 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().other.sizerust-analyzer cargo exr 1.74.0 image/Layer#size. { Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(location() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add()." > size") } |
| 980 |
else { |
| 981 |
let options = ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions# { |
| 982 |
// no tolerance for lossless channels |
| 983 |
// pxr only looses data for f32 values, B44 only for f16, not other any other types |
| 984 |
allow_lossyrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#allow_lossy.: other.encodingrust-analyzer cargo exr 1.74.0 image/Layer#encoding..compressionrust-analyzer cargo exr 1.74.0 image/Encoding#compression..may_loose_datarust-analyzer cargo exr 1.74.0 compression/impl#[Compression]may_loose_data().(),// TODO check specific channels sample types |
| 985 |
|
| 986 |
// consider nan and zero equal if the compression method does not support nan |
| 987 |
nan_converted_to_zerorust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#nan_converted_to_zero.: other.encodingrust-analyzer cargo exr 1.74.0 image/Layer#encoding..compressionrust-analyzer cargo exr 1.74.0 image/Encoding#compression..supports_nanrust-analyzer cargo exr 1.74.0 compression/impl#[Compression]supports_nan().().notrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().() |
| 988 |
}; |
| 989 |
|
| 990 |
self.channel_datarust-analyzer cargo exr 1.74.0 image/Layer#channel_data..validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#validate_result().(&other.channel_datarust-analyzer cargo exr 1.74.0 image/Layer#channel_data., options, || location() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add()." > channel_data")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 991 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 992 |
} |
| 993 |
} |
| 994 |
} |
| 995 |
|
| 996 |
impl<S> ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# for AnyChannelsrust-analyzer cargo exr 1.74.0 image/AnyChannels#<S> where S: ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# { |
| 997 |
fn validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`AnyChannels<S>`][ValidateResult]validate_result().(&self, other: &Selfrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`AnyChannels<S>`][ValidateResult], options: ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#, location: impl Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#()->Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> ValidationResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationResult# { |
| 998 |
self.listrust-analyzer cargo exr 1.74.0 image/AnyChannels#list..validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`SmallVec<A>`][ValidateResult]validate_result().(&other.listrust-analyzer cargo exr 1.74.0 image/AnyChannels#list., options, location) |
| 999 |
} |
| 1000 |
} |
| 1001 |
|
| 1002 |
impl<S> ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# for AnyChannelrust-analyzer cargo exr 1.74.0 image/AnyChannel#<S> where S: ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# { |
| 1003 |
fn validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`AnyChannel<S>`][ValidateResult]validate_result().(&self, other: &Selfrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`AnyChannel<S>`][ValidateResult], options: ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#, location: impl Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#()->Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> ValidationResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationResult# { |
| 1004 |
if self.namerust-analyzer cargo exr 1.74.0 image/AnyChannel#name. 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().other.namerust-analyzer cargo exr 1.74.0 image/AnyChannel#name. { Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(location() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add()." > name") } |
| 1005 |
else if self.quantize_linearlyrust-analyzer cargo exr 1.74.0 image/AnyChannel#quantize_linearly. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[bool][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[bool][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[bool][`PartialEq<Self>`]ne().other.quantize_linearlyrust-analyzer cargo exr 1.74.0 image/AnyChannel#quantize_linearly. { Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(location() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add()." > quantize_linearly") } |
| 1006 |
else if self.samplingrust-analyzer cargo exr 1.74.0 image/AnyChannel#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().other.samplingrust-analyzer cargo exr 1.74.0 image/AnyChannel#sampling. { Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(location() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add()." > sampling") } |
| 1007 |
else { |
| 1008 |
self.sample_datarust-analyzer cargo exr 1.74.0 image/AnyChannel#sample_data..validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#validate_result().(&other.sample_datarust-analyzer cargo exr 1.74.0 image/AnyChannel#sample_data., options, || location() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add()." > sample_data") |
| 1009 |
} |
| 1010 |
} |
| 1011 |
} |
| 1012 |
|
| 1013 |
impl<Pxs, Chans> ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# for SpecificChannelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#<Pxs, Chans> where Pxs: ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#, Chans: Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq# { |
| 1014 |
fn validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`SpecificChannels<Pxs, Chans>`][ValidateResult]validate_result().(&self, other: &Selfrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`SpecificChannels<Pxs, Chans>`][ValidateResult], options: ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#, location: impl Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#()->Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> ValidationResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationResult# { |
| 1015 |
if self.channelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#channels. 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().other.channelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#channels. { Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(location() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add()." > specific channels") } |
| 1016 |
else { self.pixelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#pixels..validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#validate_result().(&other.pixelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#pixels., options, || location() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add()." > specific pixels") } |
| 1017 |
} |
| 1018 |
} |
| 1019 |
|
| 1020 |
impl<S> ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# for Levelsrust-analyzer cargo exr 1.74.0 image/Levels#<S> where S: ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# { |
| 1021 |
fn validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`Levels<S>`][ValidateResult]validate_result().(&self, other: &Selfrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`Levels<S>`][ValidateResult], options: ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#, location: impl Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#()->Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> ValidationResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationResult# { |
| 1022 |
self.levels_as_slicerust-analyzer cargo exr 1.74.0 image/impl#[`Levels<LevelSamples>`]levels_as_slice().().validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`&[T]`][ValidateResult]validate_result().(&other.levels_as_slicerust-analyzer cargo exr 1.74.0 image/impl#[`Levels<LevelSamples>`]levels_as_slice().(), options, || location() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add()." > levels") |
| 1023 |
} |
| 1024 |
} |
| 1025 |
|
| 1026 |
impl ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# for FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples# { |
| 1027 |
fn validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[FlatSamples][ValidateResult]validate_result().(&self, other: &Selfrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[FlatSamples][ValidateResult], options: ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#, location: impl Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#()->Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> ValidationResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationResult# { |
| 1028 |
use FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#::*; |
| 1029 |
match (self, other) { |
| 1030 |
(F16rust-analyzer cargo exr 1.74.0 image/FlatSamples#F16#(values), F16rust-analyzer cargo exr 1.74.0 image/FlatSamples#F16#(other_values)) => values.as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().().validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`&[T]`][ValidateResult]validate_result().(&other_values.as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().(), options, ||location() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add()." > f16 samples"), |
| 1031 |
(F32rust-analyzer cargo exr 1.74.0 image/FlatSamples#F32#(values), F32rust-analyzer cargo exr 1.74.0 image/FlatSamples#F32#(other_values)) => values.as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().().validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`&[T]`][ValidateResult]validate_result().(&other_values.as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().(), options, ||location() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add()." > f32 samples"), |
| 1032 |
(U32rust-analyzer cargo exr 1.74.0 image/FlatSamples#U32#(values), U32rust-analyzer cargo exr 1.74.0 image/FlatSamples#U32#(other_values)) => values.as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().().validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`&[T]`][ValidateResult]validate_result().(&other_values.as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().(), options, ||location() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add()." > u32 samples"), |
| 1033 |
(own, other) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}: samples type mismatch. expected {:?}, found {:?}", location(), own.sample_typerust-analyzer cargo exr 1.74.0 image/write/samples/impl#[FlatSamples][`WritableSamples<'samples>`]sample_type().(), other.sample_typerust-analyzer cargo exr 1.74.0 image/write/samples/impl#[FlatSamples][`WritableSamples<'samples>`]sample_type().())) |
| 1034 |
} |
| 1035 |
} |
| 1036 |
} |
| 1037 |
|
| 1038 |
impl<T> ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# for &[T] where T: ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# { |
| 1039 |
fn validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`&[T]`][ValidateResult]validate_result().(&self, other: &Selfrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`&[T]`][ValidateResult], options: ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#, location: impl Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#()->Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> ValidationResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationResult# { |
| 1040 |
if self.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][`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().other.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() { Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(location() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add()." count") } |
| 1041 |
else { |
| 1042 |
for (index, (slf, other)) in self.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(other.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().() { |
| 1043 |
slf.validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#validate_result().(other, options, ||formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{} element [{}] of {}", location(), index, self.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().; |
| 1044 |
} |
| 1045 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 1046 |
} |
| 1047 |
} |
| 1048 |
} |
| 1049 |
|
| 1050 |
impl<A: Arrayrust-analyzer cargo smallvec 1.15.1 Array#> ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# for SmallVecrust-analyzer cargo smallvec 1.15.1 SmallVec#<A> where A::Itemrust-analyzer cargo smallvec 1.15.1 Array#Item#: ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# { |
| 1051 |
fn validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`SmallVec<A>`][ValidateResult]validate_result().(&self, other: &Selfrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`SmallVec<A>`][ValidateResult], options: ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#, location: impl Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#()->Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> ValidationResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationResult# { |
| 1052 |
self.as_slicerust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]as_slice().().validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`&[T]`][ValidateResult]validate_result().(&other.as_slicerust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`]as_slice().(), options, location) |
| 1053 |
} |
| 1054 |
} |
| 1055 |
|
| 1056 |
impl<A> ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# for Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<A> where A: ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# { |
| 1057 |
fn validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`Vec<A>`][ValidateResult]validate_result().(&self, other: &Selfrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`Vec<A>`][ValidateResult], options: ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#, location: impl Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#()->Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> ValidationResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationResult# { |
| 1058 |
self.as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().().validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`&[T]`][ValidateResult]validate_result().(&other.as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().(), options, location) |
| 1059 |
} |
| 1060 |
} |
| 1061 |
|
| 1062 |
impl<A,B,C,D> ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# for (A, B, C, D) where A: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#+ ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#, B: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#+ ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#, C: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#+ ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#, D: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#+ ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# { |
| 1063 |
fn validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`(A, B, C, D)`][ValidateResult]validate_result().(&self, other: &Selfrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`(A, B, C, D)`][ValidateResult], options: ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#, location: impl Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#()->Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> ValidationResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationResult# { |
| 1064 |
self.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().().into_recursiverust-analyzer cargo exr 1.74.0 image/recursive/impl#[`(A, B, C, D)`][IntoRecursive]into_recursive().().validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`Recursive<Inner, T>`][ValidateResult]validate_result().(&other.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().().into_recursiverust-analyzer cargo exr 1.74.0 image/recursive/impl#[`(A, B, C, D)`][IntoRecursive]into_recursive().(), options, location) |
| 1065 |
} |
| 1066 |
} |
| 1067 |
|
| 1068 |
impl<A,B,C> ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# for (A, B, C) where A: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#+ ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#, B: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#+ ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#, C: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#+ ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# { |
| 1069 |
fn validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`(A, B, C)`][ValidateResult]validate_result().(&self, other: &Selfrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`(A, B, C)`][ValidateResult], options: ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#, location: impl Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#()->Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> ValidationResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationResult# { |
| 1070 |
self.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().().into_recursiverust-analyzer cargo exr 1.74.0 image/recursive/impl#[`(A, B, C)`][IntoRecursive]into_recursive().().validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`Recursive<Inner, T>`][ValidateResult]validate_result().(&other.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().().into_recursiverust-analyzer cargo exr 1.74.0 image/recursive/impl#[`(A, B, C)`][IntoRecursive]into_recursive().(), options, location) |
| 1071 |
} |
| 1072 |
} |
| 1073 |
|
| 1074 |
// // (low priority because it is only used in the tests) |
| 1075 |
/*TODO |
| 1076 |
impl<Tuple> SimilarToLossy for Tuple where |
| 1077 |
Tuple: Clone + IntoRecursive, |
| 1078 |
<Tuple as IntoRecursive>::Recursive: SimilarToLossy, |
| 1079 |
{ |
| 1080 |
fn similar_to_lossy(&self, other: &Self, max_difference: f32) -> bool { |
| 1081 |
self.clone().into_recursive().similar_to_lossy(&other.clone().into_recursive(), max_difference) |
| 1082 |
} // TODO no clone? |
| 1083 |
}*/ |
| 1084 |
|
| 1085 |
|
| 1086 |
// implement for recursive types |
| 1087 |
impl ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# for NoneMorerust-analyzer cargo exr 1.74.0 image/recursive/NoneMore# { |
| 1088 |
fn validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[NoneMore][ValidateResult]validate_result().(&self, _: &Selfrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[NoneMore][ValidateResult], _: ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#, _: impl Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#()->Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> ValidationResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationResult# { Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) } |
| 1089 |
} |
| 1090 |
|
| 1091 |
impl<Inner, T> ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# for Recursiverust-analyzer cargo exr 1.74.0 image/recursive/Recursive#<Inner, T> where Inner: ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#, T: ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# { |
| 1092 |
fn validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`Recursive<Inner, T>`][ValidateResult]validate_result().(&self, other: &Selfrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`Recursive<Inner, T>`][ValidateResult], options: ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#, location: impl Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#()->Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> ValidationResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationResult# { |
| 1093 |
self.valuerust-analyzer cargo exr 1.74.0 image/recursive/Recursive#value..validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#validate_result().(&other.valuerust-analyzer cargo exr 1.74.0 image/recursive/Recursive#value., options, &location).and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]and_then().(|()| |
| 1094 |
self.innerrust-analyzer cargo exr 1.74.0 image/recursive/Recursive#inner..validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#validate_result().(&other.innerrust-analyzer cargo exr 1.74.0 image/recursive/Recursive#inner., options, &location) |
| 1095 |
) |
| 1096 |
} |
| 1097 |
} |
| 1098 |
|
| 1099 |
impl<S> ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# for Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<S> where S: ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# { |
| 1100 |
fn validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`Option<S>`][ValidateResult]validate_result().(&self, other: &Selfrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[`Option<S>`][ValidateResult], options: ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#, location: impl Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#()->Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> ValidationResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationResult# { |
| 1101 |
match (self, other) { |
| 1102 |
(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()), |
| 1103 |
(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(value), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(other)) => value.validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#validate_result().(other, options, location), |
| 1104 |
_ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(location() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().": option mismatch") |
| 1105 |
} |
| 1106 |
} |
| 1107 |
} |
| 1108 |
|
| 1109 |
impl ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# for f32 { |
| 1110 |
fn validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[f32][ValidateResult]validate_result().(&self, other: &Selfrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[f32][ValidateResult], options: ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#, location: impl Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#()->Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> ValidationResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationResult# { |
| 1111 |
if self 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().other || (self.is_nanrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]is_nan().() && other.is_nanrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]is_nan().()) || (options.nan_converted_to_zerorust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#nan_converted_to_zero. && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.is_normalrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]is_normal().() && *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().other rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialEq<Self>`]eq().0.0) { |
| 1112 |
return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()); |
| 1113 |
} |
| 1114 |
|
| 1115 |
if options.allow_lossyrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#allow_lossy. { |
| 1116 |
let epsilon = 0.06; |
| 1117 |
let max_difference = 0.1; |
| 1118 |
|
| 1119 |
let adaptive_threshold = epsilon rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().(self.absrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]abs().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().other.absrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]abs().()); |
| 1120 |
let tolerance = adaptive_threshold.maxrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]max().(max_difference); |
| 1121 |
let difference = (self rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&f32`][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&f32`][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&f32`][`Sub<Self>`]sub().other).absrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]abs().(); |
| 1122 |
|
| 1123 |
return if difference rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialOrd<Self>`]le().tolerance { Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) } |
| 1124 |
else { Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}: expected ~{}, found {} (adaptive tolerance {})", location(), self, other, tolerance)) }; |
| 1125 |
} |
| 1126 |
|
| 1127 |
Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}: expected exactly {}, found {}", location(), self, other)) |
| 1128 |
} |
| 1129 |
} |
| 1130 |
|
| 1131 |
impl ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# for f16rust-analyzer cargo half 2.6.0 binary16/f16# { |
| 1132 |
fn validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[f16][ValidateResult]validate_result().(&self, other: &Selfrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[f16][ValidateResult], options: ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#, location: impl Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#()->Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> ValidationResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationResult# { |
| 1133 |
if self.to_bitsrust-analyzer cargo half 2.6.0 binary16/impl#[f16]to_bits().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().other.to_bitsrust-analyzer cargo half 2.6.0 binary16/impl#[f16]to_bits().() { Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) } else { |
| 1134 |
self.to_f32rust-analyzer cargo exr 1.74.0 block/samples/impl#[f16][IntoNativeSample]to_f32().().validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[f32][ValidateResult]validate_result().(&other.to_f32rust-analyzer cargo exr 1.74.0 block/samples/impl#[f16][IntoNativeSample]to_f32().(), options, location) |
| 1135 |
} |
| 1136 |
} |
| 1137 |
} |
| 1138 |
|
| 1139 |
impl ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# for u32 { |
| 1140 |
fn validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[u32][ValidateResult]validate_result().(&self, other: &Selfrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[u32][ValidateResult], options: ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#, location: impl Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#()->Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> ValidationResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationResult# { |
| 1141 |
if self 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().other { Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) } else { // todo to float conversion resulting in nan/infinity? |
| 1142 |
self.to_f32rust-analyzer cargo exr 1.74.0 block/samples/impl#[u32][IntoNativeSample]to_f32().().validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[f32][ValidateResult]validate_result().(&other.to_f32rust-analyzer cargo exr 1.74.0 block/samples/impl#[u32][IntoNativeSample]to_f32().(), options, location) |
| 1143 |
} |
| 1144 |
} |
| 1145 |
} |
| 1146 |
|
| 1147 |
impl ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# for Samplerust-analyzer cargo exr 1.74.0 block/samples/Sample# { |
| 1148 |
fn validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[Sample][ValidateResult]validate_result().(&self, other: &Selfrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[Sample][ValidateResult], options: ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#, location: impl Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#()->Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> ValidationResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationResult# { |
| 1149 |
use Samplerust-analyzer cargo exr 1.74.0 block/samples/Sample#::*; |
| 1150 |
match (self, other) { |
| 1151 |
(F16rust-analyzer cargo exr 1.74.0 block/samples/Sample#F16#(a), F16rust-analyzer cargo exr 1.74.0 block/samples/Sample#F16#(b)) => a.validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[f16][ValidateResult]validate_result().(b, options, ||location() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add()." (f16)"), |
| 1152 |
(F32rust-analyzer cargo exr 1.74.0 block/samples/Sample#F32#(a), F32rust-analyzer cargo exr 1.74.0 block/samples/Sample#F32#(b)) => a.validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[f32][ValidateResult]validate_result().(b, options, ||location() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add()." (f32)"), |
| 1153 |
(U32rust-analyzer cargo exr 1.74.0 block/samples/Sample#U32#(a), U32rust-analyzer cargo exr 1.74.0 block/samples/Sample#U32#(b)) => a.validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[u32][ValidateResult]validate_result().(b, options, ||location() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add()." (u32)"), |
| 1154 |
(_,_) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(location() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().": sample type mismatch") |
| 1155 |
} |
| 1156 |
} |
| 1157 |
} |
| 1158 |
|
| 1159 |
|
| 1160 |
#[cfg(test)] |
| 1161 |
mod test_value_resultrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/ { |
| 1162 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::f32rust-analyzer cargo std https://github.com/rust-lang/rust/library/std f32/::constsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/consts/::*; |
| 1163 |
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#; |
| 1164 |
use craterust-analyzer cargo exr 1.74.0 crate/::imagerust-analyzer cargo exr 1.74.0 image/::pixel_vecrust-analyzer cargo exr 1.74.0 image/pixel_vec/::PixelVecrust-analyzer cargo exr 1.74.0 image/pixel_vec/PixelVec#; |
| 1165 |
use craterust-analyzer cargo exr 1.74.0 crate/::imagerust-analyzer cargo exr 1.74.0 image/::validate_resultsrust-analyzer cargo exr 1.74.0 image/validate_results/::{ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#, ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#}; |
| 1166 |
use craterust-analyzer cargo exr 1.74.0 crate/::metarust-analyzer cargo exr 1.74.0 meta/::attributerust-analyzer cargo exr 1.74.0 meta/attribute/::LineOrderrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#::Increasingrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#Increasing#; |
| 1167 |
use craterust-analyzer cargo exr 1.74.0 crate/::imagerust-analyzer cargo exr 1.74.0 image/::{FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#}; |
| 1168 |
|
| 1169 |
fn expect_validrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/expect_valid().<T>(original: &T, result: &T, allow_lossy: bool, nan_converted_to_zero: bool) where T: ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# { |
| 1170 |
original.validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#validate_result().( |
| 1171 |
result, |
| 1172 |
ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions# { allow_lossyrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#allow_lossy., nan_converted_to_zerorust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#nan_converted_to_zero. }, |
| 1173 |
|| Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().() |
| 1174 |
).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 1175 |
} |
| 1176 |
|
| 1177 |
fn expect_invalidrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/expect_invalid().<T>(original: &T, result: &T, allow_lossy: bool, nan_converted_to_zero: bool) where T: ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult# { |
| 1178 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(original.validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#validate_result().( |
| 1179 |
result, |
| 1180 |
ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions# { allow_lossyrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#allow_lossy., nan_converted_to_zerorust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#nan_converted_to_zero. }, |
| 1181 |
|| Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().() |
| 1182 |
).is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 1183 |
} |
| 1184 |
|
| 1185 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1186 |
fn test_f32rust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/test_f32().(){ |
| 1187 |
let original:&[f32] = &[0.0, 0.1, 0.2, 0.3, 0.4, 0.5, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().20.4, f32::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]NAN.]; |
| 1188 |
let lossy:&[f32] = &[0.0, 0.2, 0.2, 0.3, 0.4, 0.5, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().20.5, f32::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]NAN.]; |
| 1189 |
|
| 1190 |
expect_validrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/expect_valid().(&original, &original, true, true); |
| 1191 |
expect_validrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/expect_valid().(&original, &original, true, false); |
| 1192 |
expect_validrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/expect_valid().(&original, &original, false, true); |
| 1193 |
expect_validrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/expect_valid().(&original, &original, false, false); |
| 1194 |
|
| 1195 |
expect_invalidrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/expect_invalid().(&original, &lossy, false, false); |
| 1196 |
expect_validrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/expect_valid().(&original, &lossy, true, false); |
| 1197 |
|
| 1198 |
expect_invalidrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/expect_invalid().(&original, &&original[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#original.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][`Sub<Self>`]sub().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., true, true); |
| 1199 |
|
| 1200 |
// test relative comparison with some large values |
| 1201 |
expect_validrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/expect_valid().(&1_000_f32, &1_001_f32, true, false); |
| 1202 |
expect_invalidrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/expect_invalid().(&1_000_f32, &1_200_f32, true, false); |
| 1203 |
|
| 1204 |
expect_validrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/expect_valid().(&10_000_f32, &10_100_f32, true, false); |
| 1205 |
expect_invalidrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/expect_invalid().(&10_000_f32, &12_000_f32, true, false); |
| 1206 |
|
| 1207 |
expect_validrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/expect_valid().(&33_120_f32, &30_120_f32, true, false); |
| 1208 |
expect_invalidrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/expect_invalid().(&33_120_f32, &20_120_f32, true, false); |
| 1209 |
} |
| 1210 |
|
| 1211 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1212 |
fn test_nanrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/test_nan().(){ |
| 1213 |
let original:&[f32] = &[ 0.0, f32::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]NAN., f32::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]NAN. ]; |
| 1214 |
let lossy:&[f32] = &[ 0.0, f32::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]NAN., 0.0 ]; |
| 1215 |
|
| 1216 |
expect_validrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/expect_valid().(&original, &lossy, true, true); |
| 1217 |
expect_invalidrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/expect_invalid().(&lossy, &original, true, true); |
| 1218 |
|
| 1219 |
expect_validrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/expect_valid().(&lossy, &lossy, true, true); |
| 1220 |
expect_validrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/expect_valid().(&lossy, &lossy, false, true); |
| 1221 |
} |
| 1222 |
|
| •1223 |
#[ignore] |
| 1224 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1225 |
fn test_errorrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/test_error().(){ |
| 1226 |
|
| 1227 |
fn print_errorrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/print_error().<T: ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#>(original: &T, lossy: &T, allow_lossy: bool){ |
| 1228 |
let message = original |
| 1229 |
.validate_resultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#validate_result().( |
| 1230 |
&lossy, |
| 1231 |
ValidationOptionsrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions# { allow_lossyrust-analyzer cargo exr 1.74.0 image/validate_results/ValidationOptions#allow_lossy., .. Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo exr 1.74.0 image/validate_results/impl#[ValidationOptions][Default]default().() }, |
| 1232 |
|| Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().() // type_name::<T>().to_string() |
| 1233 |
) |
| 1234 |
.unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().(); |
| 1235 |
|
| 1236 |
printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("message: {}", message); |
| 1237 |
} |
| 1238 |
|
| 1239 |
let original:&[f32] = &[ 0.0, f32::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]NAN., f32::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]NAN. ]; |
| 1240 |
let lossy:&[f32] = &[ 0.0, f32::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]NAN., 0.0 ]; |
| 1241 |
print_errorrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/print_error().(&original, &lossy, false); |
| 1242 |
|
| 1243 |
print_errorrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/print_error().(&2.0, &1.0, true); |
| 1244 |
print_errorrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/print_error().(&2.0, &1.0, false); |
| 1245 |
|
| 1246 |
print_errorrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/print_error().(&FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#::F32rust-analyzer cargo exr 1.74.0 image/FlatSamples#F32#(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0.1,0.1]), &FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#::F32rust-analyzer cargo exr 1.74.0 image/FlatSamples#F32#(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0.1,0.2]), false); |
| 1247 |
print_errorrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/print_error().(&FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#::U32rust-analyzer cargo exr 1.74.0 image/FlatSamples#U32#(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0,0]), &FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#::F32rust-analyzer cargo exr 1.74.0 image/FlatSamples#F32#(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0.1,0.2]), false); |
| 1248 |
|
| 1249 |
{ |
| 1250 |
let image = craterust-analyzer cargo exr 1.74.0 crate/::preluderust-analyzer cargo exr 1.74.0 prelude/::read_all_data_from_filerust-analyzer cargo exr 1.74.0 image/read/read_all_data_from_file().("tests/images/valid/openexr/MultiResolution/Kapaa.exr").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 1251 |
|
| 1252 |
let mut mutated = image.clonerust-analyzer cargo exr 1.74.0 image/impl#[`Image<Layers>`][Clone]clone().(); |
| 1253 |
let samples = mutated.layer_datarust-analyzer cargo exr 1.74.0 image/Image#layer_data..first_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]first_mut().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().() |
| 1254 |
.channel_datarust-analyzer cargo exr 1.74.0 image/Layer#channel_data..listrust-analyzer cargo exr 1.74.0 image/AnyChannels#list..first_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]first_mut().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().sample_datarust-analyzer cargo exr 1.74.0 image/AnyChannel#sample_data..levels_as_slice_mutrust-analyzer cargo exr 1.74.0 image/impl#[`Levels<LevelSamples>`]levels_as_slice_mut().().first_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]first_mut().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 1255 |
|
| 1256 |
match samples { |
| 1257 |
FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#::F16rust-analyzer cargo exr 1.74.0 image/FlatSamples#F16#(vals) => vals[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().100]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut(). = vals[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 1258 |
FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#::F32rust-analyzer cargo exr 1.74.0 image/FlatSamples#F32#(vals) => vals[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().100]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut(). = vals[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 1259 |
FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#::U32rust-analyzer cargo exr 1.74.0 image/FlatSamples#U32#(vals) => vals[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().100]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut(). = vals[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 1260 |
} |
| 1261 |
|
| 1262 |
print_errorrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/print_error().(&image, &mutated, false); |
| 1263 |
} |
| 1264 |
|
| 1265 |
// TODO check out more nested behaviour! |
| 1266 |
} |
| 1267 |
|
| 1268 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1269 |
fn test_uncompressedrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/test_uncompressed().(){ |
| 1270 |
use craterust-analyzer cargo exr 1.74.0 crate/::preluderust-analyzer cargo exr 1.74.0 prelude/::*; |
| 1271 |
|
| 1272 |
let original_pixels: [(f32,f32,f32); 4] = [ |
| 1273 |
(0.0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().1.1, PIrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/consts/PI.), |
| 1274 |
(0.0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().1.1, TAUrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/consts/TAU.), |
| 1275 |
(0.0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().1.1, f32::EPSILONrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]EPSILON.), |
| 1276 |
(f32::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]NAN., 10000.1, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().1024.009), |
| 1277 |
]; |
| 1278 |
|
| 1279 |
let mut file_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().(); |
| 1280 |
let original_image = Imagerust-analyzer cargo exr 1.74.0 image/Image#::from_encoded_channelsrust-analyzer cargo exr 1.74.0 image/impl#[`Image<Layer<ChannelData>>`]from_encoded_channels().( |
| 1281 |
(2,2), |
| 1282 |
Encodingrust-analyzer cargo exr 1.74.0 image/Encoding# { |
| 1283 |
compressionrust-analyzer cargo exr 1.74.0 image/Encoding#compression.: Compressionrust-analyzer cargo exr 1.74.0 compression/Compression#::Uncompressedrust-analyzer cargo exr 1.74.0 compression/Compression#Uncompressed#, |
| 1284 |
line_orderrust-analyzer cargo exr 1.74.0 image/Encoding#line_order.: Increasingrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#Increasing#, // FIXME unspecified may be optimized to increasing, which destroys test eq |
| 1285 |
.. Encodingrust-analyzer cargo exr 1.74.0 image/Encoding#::defaultrust-analyzer cargo exr 1.74.0 image/impl#[Encoding][Default]default().() |
| 1286 |
}, |
| 1287 |
SpecificChannelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#::rgbrust-analyzer cargo exr 1.74.0 image/impl#[`SpecificChannels<SampleStorage, (ChannelDescription, ChannelDescription, ChannelDescription)>`]rgb().(PixelVecrust-analyzer cargo exr 1.74.0 image/pixel_vec/PixelVec#::newrust-analyzer cargo exr 1.74.0 image/pixel_vec/impl#[`PixelVec<Pixel>`]new().(Vec2rust-analyzer cargo exr 1.74.0 math/Vec2#(2,2), original_pixels.to_vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]to_vec().())) |
| 1288 |
); |
| 1289 |
|
| 1290 |
original_image.writerust-analyzer cargo exr 1.74.0 image/write/impl#[`&'img Image<WritableLayers>`][`WritableImage<'img, WritableLayers>`]write().().to_bufferedrust-analyzer cargo exr 1.74.0 image/write/impl#[`WriteImageWithOptions<'img, L, F>`]to_buffered().(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().(&mut file_bytes)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 1291 |
|
| 1292 |
let lossy_image = readrust-analyzer cargo exr 1.74.0 image/read/read().().no_deep_datarust-analyzer cargo exr 1.74.0 image/read/impl#[ReadBuilder]no_deep_data().().largest_resolution_levelrust-analyzer cargo exr 1.74.0 image/read/samples/impl#[ReadFlatSamples]largest_resolution_level().() |
| 1293 |
.rgb_channelsrust-analyzer cargo exr 1.74.0 image/read/levels/impl#[`ReadLargestLevel<DeepOrFlatSamples>`]rgb_channels().(PixelVecrust-analyzer cargo exr 1.74.0 image/pixel_vec/PixelVec#::<(f32,f32,f32)>::constructorrust-analyzer cargo exr 1.74.0 image/pixel_vec/impl#[`PixelVec<Pixel>`]constructor()., PixelVecrust-analyzer cargo exr 1.74.0 image/pixel_vec/PixelVec#::set_pixelrust-analyzer cargo exr 1.74.0 image/pixel_vec/impl#[`PixelVec<Pixel>`]set_pixel().) |
| 1294 |
.first_valid_layerrust-analyzer cargo exr 1.74.0 image/read/layers/ReadChannels#first_valid_layer().().all_attributesrust-analyzer cargo exr 1.74.0 image/read/image/ReadLayers#all_attributes().().from_bufferedrust-analyzer cargo exr 1.74.0 image/read/image/impl#[`ReadImage<F, L>`]from_buffered().(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().(&file_bytes)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 1295 |
|
| 1296 |
original_image.assert_equals_resultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#assert_equals_result().(&original_image); |
| 1297 |
lossy_image.assert_equals_resultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#assert_equals_result().(&lossy_image); |
| 1298 |
original_image.assert_equals_resultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#assert_equals_result().(&lossy_image); |
| 1299 |
lossy_image.assert_equals_resultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#assert_equals_result().(&original_image); |
| 1300 |
} |
| 1301 |
|
| 1302 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1303 |
fn test_compilesrust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/test_compiles().(){ |
| 1304 |
use craterust-analyzer cargo exr 1.74.0 crate/::preluderust-analyzer cargo exr 1.74.0 prelude/::*; |
| 1305 |
|
| 1306 |
fn accepts_validatable_valuerust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/accepts_validatable_value().(_: &impl ValidateResultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#){} |
| 1307 |
|
| 1308 |
let object: Levelsrust-analyzer cargo exr 1.74.0 image/Levels#<FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#> = Levelsrust-analyzer cargo exr 1.74.0 image/Levels#::Singularrust-analyzer cargo exr 1.74.0 image/Levels#Singular#(FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#::F32rust-analyzer cargo exr 1.74.0 image/FlatSamples#F32#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::defaultrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`][Default]default().())); |
| 1309 |
accepts_validatable_valuerust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/accepts_validatable_value().(&object); |
| 1310 |
|
| 1311 |
let object: AnyChannelsrust-analyzer cargo exr 1.74.0 image/AnyChannels#<Levelsrust-analyzer cargo exr 1.74.0 image/Levels#<FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#>> = AnyChannelsrust-analyzer cargo exr 1.74.0 image/AnyChannels#::sortrust-analyzer cargo exr 1.74.0 image/impl#[`AnyChannels<SampleData>`]sort().(SmallVecrust-analyzer cargo smallvec 1.15.1 SmallVec#::defaultrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`][Default]default().()); |
| 1312 |
accepts_validatable_valuerust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/accepts_validatable_value().(&object); |
| 1313 |
|
| 1314 |
let layer: Layerrust-analyzer cargo exr 1.74.0 image/Layer#<AnyChannelsrust-analyzer cargo exr 1.74.0 image/AnyChannels#<Levelsrust-analyzer cargo exr 1.74.0 image/Levels#<FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#>>> = Layerrust-analyzer cargo exr 1.74.0 image/Layer#::newrust-analyzer cargo exr 1.74.0 image/impl#[`Layer<ChannelData>`]new().((0,0), Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo exr 1.74.0 meta/header/impl#[LayerAttributes][Default]default().(), Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo exr 1.74.0 image/impl#[Encoding][Default]default().(), object); |
| 1315 |
accepts_validatable_valuerust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/accepts_validatable_value().(&layer); |
| 1316 |
|
| 1317 |
let layers: Layersrust-analyzer cargo exr 1.74.0 image/Layers#<AnyChannelsrust-analyzer cargo exr 1.74.0 image/AnyChannels#<Levelsrust-analyzer cargo exr 1.74.0 image/Levels#<FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#>>> = Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo smallvec 1.15.1 impl#[`SmallVec<A>`][Default]default().(); |
| 1318 |
accepts_validatable_valuerust-analyzer cargo exr 1.74.0 image/validate_results/test_value_result/accepts_validatable_value().(&layers); |
| 1319 |
|
| 1320 |
let object: Imagerust-analyzer cargo exr 1.74.0 image/Image#<Layerrust-analyzer cargo exr 1.74.0 image/Layer#<AnyChannelsrust-analyzer cargo exr 1.74.0 image/AnyChannels#<Levelsrust-analyzer cargo exr 1.74.0 image/Levels#<FlatSamplesrust-analyzer cargo exr 1.74.0 image/FlatSamples#>>>> = Imagerust-analyzer cargo exr 1.74.0 image/Image#::from_layerrust-analyzer cargo exr 1.74.0 image/impl#[`Image<Layer<ChannelData>>`]from_layer().(layer); |
| 1321 |
object.assert_equals_resultrust-analyzer cargo exr 1.74.0 image/validate_results/ValidateResult#assert_equals_result().(&object); |
| 1322 |
} |
| 1323 |
} |
| 1324 |
|
| 1325 |
|
| 1326 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1327 |
fn test_nan_compression_attributerust-analyzer cargo exr 1.74.0 image/validate_results/test_nan_compression_attribute().(){ |
| 1328 |
use craterust-analyzer cargo exr 1.74.0 crate/::preluderust-analyzer cargo exr 1.74.0 prelude/::*; |
| 1329 |
use craterust-analyzer cargo exr 1.74.0 crate/::preluderust-analyzer cargo exr 1.74.0 prelude/::Compressionrust-analyzer cargo exr 1.74.0 compression/Compression#::*; |
| 1330 |
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#; |
| 1331 |
use craterust-analyzer cargo exr 1.74.0 crate/::imagerust-analyzer cargo exr 1.74.0 image/::pixel_vecrust-analyzer cargo exr 1.74.0 image/pixel_vec/::PixelVecrust-analyzer cargo exr 1.74.0 image/pixel_vec/PixelVec#; |
| 1332 |
use craterust-analyzer cargo exr 1.74.0 crate/::preluderust-analyzer cargo exr 1.74.0 prelude/::LineOrderrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#::Increasingrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#Increasing#; |
| 1333 |
|
| 1334 |
let all_compression_methods = [ |
| 1335 |
Uncompressedrust-analyzer cargo exr 1.74.0 compression/Compression#Uncompressed#, RLErust-analyzer cargo exr 1.74.0 compression/Compression#RLE#, ZIP1rust-analyzer cargo exr 1.74.0 compression/Compression#ZIP1#, ZIP16rust-analyzer cargo exr 1.74.0 compression/Compression#ZIP16#, PXR24rust-analyzer cargo exr 1.74.0 compression/Compression#PXR24#, PIZrust-analyzer cargo exr 1.74.0 compression/Compression#PIZ#, B44rust-analyzer cargo exr 1.74.0 compression/Compression#B44#, B44Arust-analyzer cargo exr 1.74.0 compression/Compression#B44A#, |
| 1336 |
]; |
| 1337 |
|
| 1338 |
let original_pixels: [(f32,f32,f16rust-analyzer cargo half 2.6.0 binary16/f16#); 4] = [ |
| 1339 |
(f32::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]NAN., f32::from_bitsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]from_bits().(0x7fc01234), f16rust-analyzer cargo half 2.6.0 binary16/f16#::from_bitsrust-analyzer cargo half 2.6.0 binary16/impl#[f16]from_bits().(0x7E01)), |
| 1340 |
(f32::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]NAN., f32::from_bitsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]from_bits().(0xffcabcde), f16rust-analyzer cargo half 2.6.0 binary16/f16#::from_bitsrust-analyzer cargo half 2.6.0 binary16/impl#[f16]from_bits().(0x7FFF)), |
| 1341 |
(f32::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]NAN., f32::from_bitsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]from_bits().(0x7f800001), f16rust-analyzer cargo half 2.6.0 binary16/f16#::from_bitsrust-analyzer cargo half 2.6.0 binary16/impl#[f16]from_bits().(0xFE01)), |
| 1342 |
(f32::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]NAN., f32::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]NAN., f16rust-analyzer cargo half 2.6.0 binary16/f16#::NANrust-analyzer cargo half 2.6.0 binary16/impl#[f16]NAN.), |
| 1343 |
]; |
| 1344 |
|
| 1345 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!( |
| 1346 |
original_pixels.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 1347 |
.allrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]all().(|&(a,b,c)| a.is_nanrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]is_nan().() && b.is_nanrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]is_nan().() && c.is_nanrust-analyzer cargo half 2.6.0 binary16/impl#[f16]is_nan().()), |
| 1348 |
"test case has a bug" |
| 1349 |
); |
| 1350 |
|
| 1351 |
for compression in all_compression_methods { |
| 1352 |
let mut file_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().(); |
| 1353 |
|
| 1354 |
let original_image = Imagerust-analyzer cargo exr 1.74.0 image/Image#::from_encoded_channelsrust-analyzer cargo exr 1.74.0 image/impl#[`Image<Layer<ChannelData>>`]from_encoded_channels().( |
| 1355 |
(2, 2), |
| 1356 |
Encodingrust-analyzer cargo exr 1.74.0 image/Encoding# { |
| 1357 |
compressionrust-analyzer cargo exr 1.74.0 image/Encoding#compression., |
| 1358 |
line_orderrust-analyzer cargo exr 1.74.0 image/Encoding#line_order.: Increasingrust-analyzer cargo exr 1.74.0 meta/attribute/LineOrder#Increasing#, |
| 1359 |
..Encodingrust-analyzer cargo exr 1.74.0 image/Encoding#::defaultrust-analyzer cargo exr 1.74.0 image/impl#[Encoding][Default]default().() |
| 1360 |
}, |
| 1361 |
SpecificChannelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#::rgbrust-analyzer cargo exr 1.74.0 image/impl#[`SpecificChannels<SampleStorage, (ChannelDescription, ChannelDescription, ChannelDescription)>`]rgb().(PixelVecrust-analyzer cargo exr 1.74.0 image/pixel_vec/PixelVec#::newrust-analyzer cargo exr 1.74.0 image/pixel_vec/impl#[`PixelVec<Pixel>`]new().((2, 2), original_pixels.to_vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]to_vec().())) |
| 1362 |
); |
| 1363 |
|
| 1364 |
let result = original_image.writerust-analyzer cargo exr 1.74.0 image/write/impl#[`&'img Image<WritableLayers>`][`WritableImage<'img, WritableLayers>`]write().().to_bufferedrust-analyzer cargo exr 1.74.0 image/write/impl#[`WriteImageWithOptions<'img, L, F>`]to_buffered().(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().(&mut file_bytes)); |
| 1365 |
if let Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo exr 1.74.0 error/Error#::NotSupportedrust-analyzer cargo exr 1.74.0 error/Error#NotSupported#(_)) = result { continue; } |
| 1366 |
|
| 1367 |
let reconstructed_image = |
| 1368 |
readrust-analyzer cargo exr 1.74.0 image/read/read().().no_deep_datarust-analyzer cargo exr 1.74.0 image/read/impl#[ReadBuilder]no_deep_data().().largest_resolution_levelrust-analyzer cargo exr 1.74.0 image/read/samples/impl#[ReadFlatSamples]largest_resolution_level().() |
| 1369 |
.rgb_channelsrust-analyzer cargo exr 1.74.0 image/read/levels/impl#[`ReadLargestLevel<DeepOrFlatSamples>`]rgb_channels().(PixelVecrust-analyzer cargo exr 1.74.0 image/pixel_vec/PixelVec#::<(f32, f32, f16rust-analyzer cargo half 2.6.0 binary16/f16#)>::constructorrust-analyzer cargo exr 1.74.0 image/pixel_vec/impl#[`PixelVec<Pixel>`]constructor()., PixelVecrust-analyzer cargo exr 1.74.0 image/pixel_vec/PixelVec#::set_pixelrust-analyzer cargo exr 1.74.0 image/pixel_vec/impl#[`PixelVec<Pixel>`]set_pixel().) |
| 1370 |
.first_valid_layerrust-analyzer cargo exr 1.74.0 image/read/layers/ReadChannels#first_valid_layer().().all_attributesrust-analyzer cargo exr 1.74.0 image/read/image/ReadLayers#all_attributes().().from_bufferedrust-analyzer cargo exr 1.74.0 image/read/image/impl#[`ReadImage<F, L>`]from_buffered().(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().(&file_bytes)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 1371 |
|
| 1372 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1373 |
original_image.layer_datarust-analyzer cargo exr 1.74.0 image/Image#layer_data..channel_datarust-analyzer cargo exr 1.74.0 image/Layer#channel_data..pixelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#pixels..pixelsrust-analyzer cargo exr 1.74.0 image/pixel_vec/PixelVec#pixels..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), |
| 1374 |
reconstructed_image.layer_datarust-analyzer cargo exr 1.74.0 image/Image#layer_data..channel_datarust-analyzer cargo exr 1.74.0 image/Layer#channel_data..pixelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#pixels..pixelsrust-analyzer cargo exr 1.74.0 image/pixel_vec/PixelVec#pixels..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() |
| 1375 |
); |
| 1376 |
|
| 1377 |
let was_nanness_preserved = reconstructed_image.layer_datarust-analyzer cargo exr 1.74.0 image/Image#layer_data..channel_datarust-analyzer cargo exr 1.74.0 image/Layer#channel_data..pixelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#pixels..pixelsrust-analyzer cargo exr 1.74.0 image/pixel_vec/PixelVec#pixels. |
| 1378 |
.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().allrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]all().(|(r,g,b)| r.is_nanrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]is_nan().() && g.is_nanrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]is_nan().() && b.is_nanrust-analyzer cargo half 2.6.0 binary16/impl#[f16]is_nan().()); |
| 1379 |
|
| 1380 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1381 |
was_nanness_preserved, compression.supports_nanrust-analyzer cargo exr 1.74.0 compression/impl#[Compression]supports_nan().(), |
| 1382 |
"{} nanness claims do not match real output", compression |
| 1383 |
); |
| 1384 |
|
| 1385 |
let was_nan_pattern_preserved = reconstructed_image.layer_datarust-analyzer cargo exr 1.74.0 image/Image#layer_data..channel_datarust-analyzer cargo exr 1.74.0 image/Layer#channel_data..pixelsrust-analyzer cargo exr 1.74.0 image/SpecificChannels#pixels..pixelsrust-analyzer cargo exr 1.74.0 image/pixel_vec/PixelVec#pixels. |
| 1386 |
.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(original_pixels.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()) |
| 1387 |
.allrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#all().(|((r2, g2, b2), (r1, g1, b1))| |
| 1388 |
r2.to_bitsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]to_bits().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq().r1.to_bitsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]to_bits().() && |
| 1389 |
g2.to_bitsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]to_bits().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq().g1.to_bitsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]to_bits().() && |
| 1390 |
b2.to_bitsrust-analyzer cargo half 2.6.0 binary16/impl#[f16]to_bits().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().b1.to_bitsrust-analyzer cargo half 2.6.0 binary16/impl#[f16]to_bits().() |
| 1391 |
); |
| 1392 |
|
| 1393 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1394 |
was_nan_pattern_preserved, compression.preserves_nan_bitsrust-analyzer cargo exr 1.74.0 compression/impl#[Compression]preserves_nan_bits().(), |
| 1395 |
"{} nan bit claims do not match real output", compression |
| 1396 |
); |
| 1397 |
} |
| 1398 |
} |
| 1399 |
} |
| 1400 |
|
| 1401 |
|