| 1 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#; |
| 2 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/; |
| 3 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::Filerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/File#; |
| 4 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::{BufReadrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/BufRead#, BufReaderrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/BufReader#, Cursorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/Cursor#, Seekrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Seek#}; |
| 5 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#; |
| 6 | |
| 7 | mod containerrust-analyzer cargo imagesize 0.13.0 container/; |
| 8 | mod formatsrust-analyzer cargo imagesize 0.13.0 formats/; |
| 9 | mod utilrust-analyzer cargo imagesize 0.13.0 util/; |
| 10 | |
| 11 | pub use containerrust-analyzer cargo imagesize 0.13.0 container/::heifrust-analyzer cargo imagesize 0.13.0 container/heif/::Compressionrust-analyzer cargo imagesize 0.13.0 container/heif/Compression#; |
| 12 | use { |
| 13 | containerrust-analyzer cargo imagesize 0.13.0 container/::heifrust-analyzer cargo imagesize 0.13.0 container/heif/::{selfrust-analyzer cargo imagesize 0.13.0 container/heif/}, |
| 14 | formatsrust-analyzer cargo imagesize 0.13.0 formats/::*, |
| 15 | }; |
| 16 | |
| 17 | /// An Error type used in failure cases. |
| 18 | #[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:)] |
| 19 | pub enum ImageErrorrust-analyzer cargo imagesize 0.13.0 ImageError# { |
| 20 | /// Used when the given data is not a supported format. |
| 21 | NotSupportedrust-analyzer cargo imagesize 0.13.0 ImageError#NotSupported#, |
| 22 | /// Used when the image has an invalid format. |
| 23 | CorruptedImagerust-analyzer cargo imagesize 0.13.0 ImageError#CorruptedImage#, |
| 24 | /// Used when an IoError occurs when trying to read the given data. |
| 25 | IoErrorrust-analyzer cargo imagesize 0.13.0 ImageError#IoError#(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/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#), |
| 26 | } |
| 27 | |
| 28 | impl Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# for ImageErrorrust-analyzer cargo imagesize 0.13.0 ImageError# {} |
| 29 | |
| 30 | impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for ImageErrorrust-analyzer cargo imagesize 0.13.0 ImageError# { |
| 31 | fn fmtrust-analyzer cargo imagesize 0.13.0 impl#[ImageError][Display]fmt().(&self, f: &mut 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#) -> 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# { |
| 32 | use selfrust-analyzer cargo imagesize 0.13.0 crate/::ImageErrorrust-analyzer cargo imagesize 0.13.0 ImageError#::*; |
| 33 | match self { |
| 34 | NotSupportedrust-analyzer cargo imagesize 0.13.0 ImageError#NotSupported# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("Could not decode image"), |
| 35 | CorruptedImagerust-analyzer cargo imagesize 0.13.0 ImageError#CorruptedImage# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("Hit end of file before finding size"), |
| 36 | IoErrorrust-analyzer cargo imagesize 0.13.0 ImageError#IoError#(error) => error.fmtrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error][Display]fmt().(f), |
| 37 | } |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<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/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#> for ImageErrorrust-analyzer cargo imagesize 0.13.0 ImageError# { |
| 42 | fn fromrust-analyzer cargo imagesize 0.13.0 impl#[ImageError][`From<std::io::Error>`]from().(err: 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/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#) -> ImageErrorrust-analyzer cargo imagesize 0.13.0 ImageError# { |
| 43 | ImageErrorrust-analyzer cargo imagesize 0.13.0 ImageError#::IoErrorrust-analyzer cargo imagesize 0.13.0 ImageError#IoError#(err) |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | pub type ImageResultrust-analyzer cargo imagesize 0.13.0 ImageResult#<T> = Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<T, ImageErrorrust-analyzer cargo imagesize 0.13.0 ImageError#>; |
| 48 | |
| 49 | /// Types of image formats that this crate can identify. |
| 50 | #[non_exhaustive] |
| 51 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd:, Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:)] |
| 52 | pub enum ImageTyperust-analyzer cargo imagesize 0.13.0 ImageType# { |
| 53 | /// Animated sprite image format |
| 54 | /// <https://github.com/aseprite/aseprite> |
| 55 | Asepriterust-analyzer cargo imagesize 0.13.0 ImageType#Aseprite#, |
| 56 | /// Standard Bitmap |
| 57 | Bmprust-analyzer cargo imagesize 0.13.0 ImageType#Bmp#, |
| 58 | /// DirectDraw Surface |
| 59 | Ddsrust-analyzer cargo imagesize 0.13.0 ImageType#Dds#, |
| 60 | /// OpenEXR |
| 61 | Exrrust-analyzer cargo imagesize 0.13.0 ImageType#Exr#, |
| 62 | /// Farbfeld |
| 63 | /// <https://tools.suckless.org/farbfeld/> |
| 64 | Farbfeldrust-analyzer cargo imagesize 0.13.0 ImageType#Farbfeld#, |
| 65 | /// Standard GIF |
| 66 | Gifrust-analyzer cargo imagesize 0.13.0 ImageType#Gif#, |
| 67 | /// Radiance HDR |
| 68 | Hdrrust-analyzer cargo imagesize 0.13.0 ImageType#Hdr#, |
| 69 | /// Image Container Format |
| 70 | Heifrust-analyzer cargo imagesize 0.13.0 ImageType#Heif#(Compressionrust-analyzer cargo imagesize 0.13.0 container/heif/Compression#), |
| 71 | /// Icon file |
| 72 | Icorust-analyzer cargo imagesize 0.13.0 ImageType#Ico#, |
| 73 | /// Interleaved Bitmap |
| 74 | Ilbmrust-analyzer cargo imagesize 0.13.0 ImageType#Ilbm#, |
| 75 | /// Standard JPEG |
| 76 | Jpegrust-analyzer cargo imagesize 0.13.0 ImageType#Jpeg#, |
| 77 | /// JPEG XL |
| 78 | Jxlrust-analyzer cargo imagesize 0.13.0 ImageType#Jxl#, |
| 79 | /// Khronos Texture Container |
| 80 | Ktx2rust-analyzer cargo imagesize 0.13.0 ImageType#Ktx2#, |
| 81 | /// Standard PNG |
| 82 | Pngrust-analyzer cargo imagesize 0.13.0 ImageType#Png#, |
| 83 | /// Portable Any Map |
| 84 | Pnmrust-analyzer cargo imagesize 0.13.0 ImageType#Pnm#, |
| 85 | /// Photoshop Document |
| 86 | Psdrust-analyzer cargo imagesize 0.13.0 ImageType#Psd#, |
| 87 | /// Quite OK Image Format |
| 88 | /// <https://qoiformat.org/> |
| 89 | Qoirust-analyzer cargo imagesize 0.13.0 ImageType#Qoi#, |
| 90 | /// Truevision Graphics Adapter |
| 91 | Tgarust-analyzer cargo imagesize 0.13.0 ImageType#Tga#, |
| 92 | /// Standard TIFF |
| 93 | Tiffrust-analyzer cargo imagesize 0.13.0 ImageType#Tiff#, |
| 94 | /// Valve Texture Format |
| 95 | Vtfrust-analyzer cargo imagesize 0.13.0 ImageType#Vtf#, |
| 96 | /// Standard Webp |
| 97 | Webprust-analyzer cargo imagesize 0.13.0 ImageType#Webp#, |
| 98 | } |
| 99 | |
| 100 | /// Holds the size information of an image. |
| 101 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:)] |
| 102 | pub struct ImageSizerust-analyzer cargo imagesize 0.13.0 ImageSize# { |
| 103 | /// Width of an image in pixels. |
| 104 | pub widthrust-analyzer cargo imagesize 0.13.0 ImageSize#width.: usize, |
| 105 | /// Height of an image in pixels. |
| 106 | pub heightrust-analyzer cargo imagesize 0.13.0 ImageSize#height.: usize, |
| 107 | } |
| 108 | |
| 109 | impl Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# for ImageSizerust-analyzer cargo imagesize 0.13.0 ImageSize# { |
| 110 | fn cmprust-analyzer cargo imagesize 0.13.0 impl#[ImageSize][Ord]cmp().(&self, other: &Selfrust-analyzer cargo imagesize 0.13.0 impl#[ImageSize][Ord]) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering# { |
| 111 | (self.widthrust-analyzer cargo imagesize 0.13.0 ImageSize#width. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().self.heightrust-analyzer cargo imagesize 0.13.0 ImageSize#height.).cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][Ord]cmp().(&(other.widthrust-analyzer cargo imagesize 0.13.0 ImageSize#width. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().other.heightrust-analyzer cargo imagesize 0.13.0 ImageSize#height.)) |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | impl PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd# for ImageSizerust-analyzer cargo imagesize 0.13.0 ImageSize# { |
| 116 | fn partial_cmprust-analyzer cargo imagesize 0.13.0 impl#[ImageSize][`PartialOrd<Self>`]partial_cmp().(&self, other: &Selfrust-analyzer cargo imagesize 0.13.0 impl#[ImageSize][`PartialOrd<Self>`]) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#> { |
| 117 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.cmprust-analyzer cargo imagesize 0.13.0 impl#[ImageSize][Ord]cmp().(other)) |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | /// Get the image type from a header |
| 122 | /// |
| 123 | /// # Arguments |
| 124 | /// * `header` - The header of the file. |
| 125 | /// |
| 126 | /// # Remarks |
| 127 | /// |
| 128 | /// This will check the header to determine what image type the data is. |
| 129 | pub fn image_typerust-analyzer cargo imagesize 0.13.0 image_type().(header: &[u8]) -> ImageResultrust-analyzer cargo imagesize 0.13.0 ImageResult#<ImageTyperust-analyzer cargo imagesize 0.13.0 ImageType#> { |
| 130 | formatsrust-analyzer cargo imagesize 0.13.0 formats/::image_typerust-analyzer cargo imagesize 0.13.0 formats/image_type().(&mut Cursorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/Cursor#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/impl#[`Cursor<T>`]new().(header)) |
| 131 | } |
| 132 | |
| 133 | /// Get the image size from a local file |
| 134 | /// |
| 135 | /// # Arguments |
| 136 | /// * `path` - A local path to the file to parse. |
| 137 | /// |
| 138 | /// # Remarks |
| 139 | /// |
| 140 | /// Will try to read as little of the file as possible in order to get the |
| 141 | /// proper size information. |
| 142 | /// |
| 143 | /// # Error |
| 144 | /// |
| 145 | /// This method will return an [`ImageError`] under the following conditions: |
| 146 | /// |
| 147 | /// * The header isn't recognized as a supported image format |
| 148 | /// * The data isn't long enough to find the size for the given format |
| 149 | /// |
| 150 | /// The minimum data required is 12 bytes. Anything shorter will return [`ImageError::IoError`]. |
| 151 | /// |
| 152 | /// # Examples |
| 153 | /// |
| 154 | /// ``` |
| 155 | /// use imagesize::size; |
| 156 | /// |
| 157 | /// match size("test/test.webp") { |
| 158 | /// Ok(dim) => { |
| 159 | /// assert_eq!(dim.width, 716); |
| 160 | /// assert_eq!(dim.height, 716); |
| 161 | /// } |
| 162 | /// Err(why) => println!("Error getting size: {:?}", why) |
| 163 | /// } |
| 164 | /// ``` |
| 165 | /// |
| 166 | /// [`ImageError`]: enum.ImageError.html |
| 167 | pub fn sizerust-analyzer cargo imagesize 0.13.0 size().<P: AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#>>(path: P) -> ImageResultrust-analyzer cargo imagesize 0.13.0 ImageResult#<ImageSizerust-analyzer cargo imagesize 0.13.0 ImageSize#> { |
| 168 | let file = Filerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/File#::openrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[File]open().(path)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 169 | let reader = BufReaderrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/BufReader#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`]new().(file); |
| 170 | reader_sizerust-analyzer cargo imagesize 0.13.0 reader_size().(reader) |
| 171 | } |
| 172 | |
| 173 | /// Get the image size from a block of raw data. |
| 174 | /// |
| 175 | /// # Arguments |
| 176 | /// * `data` - A Vec containing the data to parse for image size. |
| 177 | /// |
| 178 | /// # Error |
| 179 | /// |
| 180 | /// This method will return an [`ImageError`] under the following conditions: |
| 181 | /// |
| 182 | /// * The header isn't recognized as a supported image format |
| 183 | /// * The data isn't long enough to find the size for the given format |
| 184 | /// |
| 185 | /// The minimum data required is 12 bytes. Anything shorter will return [`ImageError::IoError`]. |
| 186 | /// |
| 187 | /// # Examples |
| 188 | /// |
| 189 | /// ``` |
| 190 | /// use imagesize::blob_size; |
| 191 | /// |
| 192 | /// // First few bytes of arbitrary data. |
| 193 | /// let data = vec![0x89, 0x89, 0x89, 0x89, 0x0D, 0x0A, 0x1A, 0x0A, |
| 194 | /// 0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52, |
| 195 | /// 0x00, 0x00, 0x00, 0x7B, 0x01, 0x00, 0x01, 0x41, |
| 196 | /// 0x08, 0x06, 0x00, 0x00, 0x00, 0x9A, 0x38, 0xC4]; |
| 197 | /// |
| 198 | /// assert_eq!(blob_size(&data).is_err(), true); |
| 199 | /// ``` |
| 200 | /// |
| 201 | /// [`ImageError`]: enum.ImageError.html |
| 202 | pub fn blob_sizerust-analyzer cargo imagesize 0.13.0 blob_size().(data: &[u8]) -> ImageResultrust-analyzer cargo imagesize 0.13.0 ImageResult#<ImageSizerust-analyzer cargo imagesize 0.13.0 ImageSize#> { |
| 203 | let reader = 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().(data); |
| 204 | reader_sizerust-analyzer cargo imagesize 0.13.0 reader_size().(reader) |
| 205 | } |
| 206 | |
| 207 | /// Get the image size from a reader |
| 208 | /// |
| 209 | /// # Arguments |
| 210 | /// * `reader` - A reader for the data |
| 211 | /// |
| 212 | /// # Error |
| 213 | /// |
| 214 | /// This method will return an [`ImageError`] under the following conditions: |
| 215 | /// |
| 216 | /// * The header isn't recognized as a supported image format |
| 217 | /// * The data isn't long enough to find the size for the given format |
| 218 | /// |
| 219 | /// The minimum data required is 12 bytes. Anything shorter will return [`ImageError::IoError`]. |
| 220 | /// |
| 221 | /// # Examples |
| 222 | /// |
| 223 | /// ``` |
| 224 | /// use std::io::Cursor; |
| 225 | /// use imagesize::reader_size; |
| 226 | /// |
| 227 | /// // PNG Header with size 123x321 |
| 228 | /// let reader = Cursor::new([ |
| 229 | /// 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, |
| 230 | /// 0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52, |
| 231 | /// 0x00, 0x00, 0x00, 0x7B, 0x00, 0x00, 0x01, 0x41, |
| 232 | /// 0x08, 0x06, 0x00, 0x00, 0x00, 0x9A, 0x38, 0xC4 |
| 233 | /// ]); |
| 234 | /// |
| 235 | /// match reader_size(reader) { |
| 236 | /// Ok(dim) => { |
| 237 | /// assert_eq!(dim.width, 123); |
| 238 | /// assert_eq!(dim.height, 321); |
| 239 | /// } |
| 240 | /// Err(why) => println!("Error getting reader size: {:?}", why) |
| 241 | /// } |
| 242 | /// ``` |
| 243 | /// |
| 244 | /// [`ImageError`]: enum.ImageError.html |
| 245 | pub fn reader_sizerust-analyzer cargo imagesize 0.13.0 reader_size().<R: BufReadrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/BufRead# + Seekrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Seek#>(mut reader: R) -> ImageResultrust-analyzer cargo imagesize 0.13.0 ImageResult#<ImageSizerust-analyzer cargo imagesize 0.13.0 ImageSize#> { |
| 246 | dispatch_headerrust-analyzer cargo imagesize 0.13.0 dispatch_header().(&mut reader) |
| 247 | } |
| 248 | |
| 249 | /// Calls the correct image size method based on the image type |
| 250 | /// |
| 251 | /// # Arguments |
| 252 | /// * `reader` - A reader for the data |
| 253 | /// * `header` - The header of the file |
| 254 | fn dispatch_headerrust-analyzer cargo imagesize 0.13.0 dispatch_header().<R: BufReadrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/BufRead# + Seekrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Seek#>(reader: &mut R) -> ImageResultrust-analyzer cargo imagesize 0.13.0 ImageResult#<ImageSizerust-analyzer cargo imagesize 0.13.0 ImageSize#> { |
| 255 | match formatsrust-analyzer cargo imagesize 0.13.0 formats/::image_typerust-analyzer cargo imagesize 0.13.0 formats/image_type().(reader)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). { |
| 256 | ImageTyperust-analyzer cargo imagesize 0.13.0 ImageType#::Asepriterust-analyzer cargo imagesize 0.13.0 ImageType#Aseprite# => aespriterust-analyzer cargo imagesize 0.13.0 formats/aesprite/::sizerust-analyzer cargo imagesize 0.13.0 formats/aesprite/size().(reader), |
| 257 | ImageTyperust-analyzer cargo imagesize 0.13.0 ImageType#::Bmprust-analyzer cargo imagesize 0.13.0 ImageType#Bmp# => bmprust-analyzer cargo imagesize 0.13.0 formats/bmp/::sizerust-analyzer cargo imagesize 0.13.0 formats/bmp/size().(reader), |
| 258 | ImageTyperust-analyzer cargo imagesize 0.13.0 ImageType#::Ddsrust-analyzer cargo imagesize 0.13.0 ImageType#Dds# => ddsrust-analyzer cargo imagesize 0.13.0 formats/dds/::sizerust-analyzer cargo imagesize 0.13.0 formats/dds/size().(reader), |
| 259 | ImageTyperust-analyzer cargo imagesize 0.13.0 ImageType#::Exrrust-analyzer cargo imagesize 0.13.0 ImageType#Exr# => exrrust-analyzer cargo imagesize 0.13.0 formats/exr/::sizerust-analyzer cargo imagesize 0.13.0 formats/exr/size().(reader), |
| 260 | ImageTyperust-analyzer cargo imagesize 0.13.0 ImageType#::Farbfeldrust-analyzer cargo imagesize 0.13.0 ImageType#Farbfeld# => farbfeldrust-analyzer cargo imagesize 0.13.0 formats/farbfeld/::sizerust-analyzer cargo imagesize 0.13.0 formats/farbfeld/size().(reader), |
| 261 | ImageTyperust-analyzer cargo imagesize 0.13.0 ImageType#::Gifrust-analyzer cargo imagesize 0.13.0 ImageType#Gif# => gifrust-analyzer cargo imagesize 0.13.0 formats/gif/::sizerust-analyzer cargo imagesize 0.13.0 formats/gif/size().(reader), |
| 262 | ImageTyperust-analyzer cargo imagesize 0.13.0 ImageType#::Hdrrust-analyzer cargo imagesize 0.13.0 ImageType#Hdr# => hdrrust-analyzer cargo imagesize 0.13.0 formats/hdr/::sizerust-analyzer cargo imagesize 0.13.0 formats/hdr/size().(reader), |
| 263 | ImageTyperust-analyzer cargo imagesize 0.13.0 ImageType#::Icorust-analyzer cargo imagesize 0.13.0 ImageType#Ico# => icorust-analyzer cargo imagesize 0.13.0 formats/ico/::sizerust-analyzer cargo imagesize 0.13.0 formats/ico/size().(reader), |
| 264 | ImageTyperust-analyzer cargo imagesize 0.13.0 ImageType#::Ilbmrust-analyzer cargo imagesize 0.13.0 ImageType#Ilbm# => ilbmrust-analyzer cargo imagesize 0.13.0 formats/ilbm/::sizerust-analyzer cargo imagesize 0.13.0 formats/ilbm/size().(reader), |
| 265 | ImageTyperust-analyzer cargo imagesize 0.13.0 ImageType#::Jpegrust-analyzer cargo imagesize 0.13.0 ImageType#Jpeg# => jpegrust-analyzer cargo imagesize 0.13.0 formats/jpeg/::sizerust-analyzer cargo imagesize 0.13.0 formats/jpeg/size().(reader), |
| 266 | ImageTyperust-analyzer cargo imagesize 0.13.0 ImageType#::Jxlrust-analyzer cargo imagesize 0.13.0 ImageType#Jxl# => jxlrust-analyzer cargo imagesize 0.13.0 formats/jxl/::sizerust-analyzer cargo imagesize 0.13.0 formats/jxl/size().(reader), |
| 267 | ImageTyperust-analyzer cargo imagesize 0.13.0 ImageType#::Ktx2rust-analyzer cargo imagesize 0.13.0 ImageType#Ktx2# => ktx2rust-analyzer cargo imagesize 0.13.0 formats/ktx2/::sizerust-analyzer cargo imagesize 0.13.0 formats/ktx2/size().(reader), |
| 268 | ImageTyperust-analyzer cargo imagesize 0.13.0 ImageType#::Pngrust-analyzer cargo imagesize 0.13.0 ImageType#Png# => pngrust-analyzer cargo imagesize 0.13.0 formats/png/::sizerust-analyzer cargo imagesize 0.13.0 formats/png/size().(reader), |
| 269 | ImageTyperust-analyzer cargo imagesize 0.13.0 ImageType#::Pnmrust-analyzer cargo imagesize 0.13.0 ImageType#Pnm# => pnmrust-analyzer cargo imagesize 0.13.0 formats/pnm/::sizerust-analyzer cargo imagesize 0.13.0 formats/pnm/size().(reader), |
| 270 | ImageTyperust-analyzer cargo imagesize 0.13.0 ImageType#::Psdrust-analyzer cargo imagesize 0.13.0 ImageType#Psd# => psdrust-analyzer cargo imagesize 0.13.0 formats/psd/::sizerust-analyzer cargo imagesize 0.13.0 formats/psd/size().(reader), |
| 271 | ImageTyperust-analyzer cargo imagesize 0.13.0 ImageType#::Qoirust-analyzer cargo imagesize 0.13.0 ImageType#Qoi# => qoirust-analyzer cargo imagesize 0.13.0 formats/qoi/::sizerust-analyzer cargo imagesize 0.13.0 formats/qoi/size().(reader), |
| 272 | ImageTyperust-analyzer cargo imagesize 0.13.0 ImageType#::Tgarust-analyzer cargo imagesize 0.13.0 ImageType#Tga# => tgarust-analyzer cargo imagesize 0.13.0 formats/tga/::sizerust-analyzer cargo imagesize 0.13.0 formats/tga/size().(reader), |
| 273 | ImageTyperust-analyzer cargo imagesize 0.13.0 ImageType#::Tiffrust-analyzer cargo imagesize 0.13.0 ImageType#Tiff# => tiffrust-analyzer cargo imagesize 0.13.0 formats/tiff/::sizerust-analyzer cargo imagesize 0.13.0 formats/tiff/size().(reader), |
| 274 | ImageTyperust-analyzer cargo imagesize 0.13.0 ImageType#::Vtfrust-analyzer cargo imagesize 0.13.0 ImageType#Vtf# => vtfrust-analyzer cargo imagesize 0.13.0 formats/vtf/::sizerust-analyzer cargo imagesize 0.13.0 formats/vtf/size().(reader), |
| 275 | ImageTyperust-analyzer cargo imagesize 0.13.0 ImageType#::Webprust-analyzer cargo imagesize 0.13.0 ImageType#Webp# => webprust-analyzer cargo imagesize 0.13.0 formats/webp/::sizerust-analyzer cargo imagesize 0.13.0 formats/webp/size().(reader), |
| 276 | |
| 277 | ImageTyperust-analyzer cargo imagesize 0.13.0 ImageType#::Heifrust-analyzer cargo imagesize 0.13.0 ImageType#Heif#(..) => heifrust-analyzer cargo imagesize 0.13.0 container/heif/::sizerust-analyzer cargo imagesize 0.13.0 container/heif/size().(reader), |
| 278 | } |
| 279 | } |