Debian Codegraph @

tests/encode_images.rs

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 extern crate tiffrust-analyzer cargo tiff 0.11.3 tiff/;
2
3 use tiffrust-analyzer cargo tiff 0.11.3 crate/::decoderrust-analyzer cargo tiff 0.11.3 decoder/::{ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/, Decoderrust-analyzer cargo tiff 0.11.3 decoder/Decoder#, DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#};
4 use tiffrust-analyzer cargo tiff 0.11.3 crate/::encoderrust-analyzer cargo tiff 0.11.3 encoder/::{colortyperust-analyzer cargo tiff 0.11.3 encoder/colortype/, Ifdrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Ifd#, Ifd8rust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Ifd8#, SRationalrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/SRational#, TiffEncoderrust-analyzer cargo tiff 0.11.3 encoder/TiffEncoder#};
5 use tiffrust-analyzer cargo tiff 0.11.3 crate/::tagsrust-analyzer cargo tiff 0.11.3 tags/::Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#;
6 use tiffrust-analyzer cargo tiff 0.11.3 crate/::ColorTyperust-analyzer cargo tiff 0.11.3 ColorType#;
7
8 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#;
9 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#, Seekrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Seek#, SeekFromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/SeekFrom#};
10 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/::PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#;
11
12 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
13 fn encode_decoderust-analyzer cargo tiff 0.11.3 encode_decode().() {
14 let mut image_data = 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().();
15 for x in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#100 {
16 for y in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#100u8 {
17 let val = x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add().y;
18 image_data.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(val);
19 image_data.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(val);
20 image_data.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(val);
21 }
22 }
23 let mut file = 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().(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().());
24 {
25 let mut tiff = TiffEncoderrust-analyzer cargo tiff 0.11.3 encoder/TiffEncoder#::newrust-analyzer cargo tiff 0.11.3 encoder/impl#[`TiffEncoder<W>`]new().(&mut file).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
26
27 let mut image = tiff.new_imagerust-analyzer cargo tiff 0.11.3 encoder/impl#[`TiffEncoder<W, K>`]new_image().::<colortyperust-analyzer cargo tiff 0.11.3 encoder/colortype/::RGB8rust-analyzer cargo tiff 0.11.3 encoder/colortype/RGB8#>(100, 100).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
28 image
29 .encoderrust-analyzer cargo tiff 0.11.3 encoder/impl#[`ImageEncoder<'a, W, T, K>`]encoder().()
30 .write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Artistrust-analyzer cargo tiff 0.11.3 tags/Tag#Artist#, "Image-tiff")
31 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
32 image.write_datarust-analyzer cargo tiff 0.11.3 encoder/impl#[`ImageEncoder<'a, W, T, K>`]write_data().(&image_data).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
33 }
34 {
35 file.seekrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/impl#[`Cursor<T>`][Seek]seek().(SeekFromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/SeekFrom#::Startrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/SeekFrom#Start#(0)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
36 let mut decoder = Decoderrust-analyzer cargo tiff 0.11.3 decoder/Decoder#::newrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]new().(&mut file).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
37 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.colortyperust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]colortype().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), ColorTyperust-analyzer cargo tiff 0.11.3 ColorType#::RGBrust-analyzer cargo tiff 0.11.3 ColorType#RGB#(8));
38 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.dimensionsrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]dimensions().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), (100, 100));
39
40 let mut all_tags = decoder
41 .tag_iterrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]tag_iter().()
42 .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#::okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().)
43 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>();
44 all_tags.sort_by_keyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]sort_by_key().(|(t, _)| t.to_u16rust-analyzer cargo tiff 0.11.3 tags/impl#[Tag]to_u16().());
45 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
46 all_tags,
47 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
48 (Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::ImageWidthrust-analyzer cargo tiff 0.11.3 tags/Tag#ImageWidth#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Unsignedrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Unsigned#(100)),
49 (Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::ImageLengthrust-analyzer cargo tiff 0.11.3 tags/Tag#ImageLength#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Unsignedrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Unsigned#(100)),
50 (
51 Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::BitsPerSamplerust-analyzer cargo tiff 0.11.3 tags/Tag#BitsPerSample#,
52 ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Listrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#List#(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
53 ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Shortrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Short#(8),
54 ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Shortrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Short#(8),
55 ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Shortrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Short#(8)
56 ])
57 ),
58 (Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Compressionrust-analyzer cargo tiff 0.11.3 tags/Tag#Compression#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Shortrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Short#(1)),
59 (Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::PhotometricInterpretationrust-analyzer cargo tiff 0.11.3 tags/Tag#PhotometricInterpretation#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Shortrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Short#(2)),
60 (Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::StripOffsetsrust-analyzer cargo tiff 0.11.3 tags/Tag#StripOffsets#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Unsignedrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Unsigned#(35)),
61 (Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::SamplesPerPixelrust-analyzer cargo tiff 0.11.3 tags/Tag#SamplesPerPixel#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Shortrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Short#(3)),
62 (Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::RowsPerStriprust-analyzer cargo tiff 0.11.3 tags/Tag#RowsPerStrip#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Unsignedrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Unsigned#(3334)),
63 (Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::StripByteCountsrust-analyzer cargo tiff 0.11.3 tags/Tag#StripByteCounts#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Unsignedrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Unsigned#(30000)),
64 (Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::XResolutionrust-analyzer cargo tiff 0.11.3 tags/Tag#XResolution#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Rationalrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Rational#(1, 1)),
65 (Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::YResolutionrust-analyzer cargo tiff 0.11.3 tags/Tag#YResolution#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Rationalrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Rational#(1, 1)),
66 (Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::ResolutionUnitrust-analyzer cargo tiff 0.11.3 tags/Tag#ResolutionUnit#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Shortrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Short#(1)),
67 (Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Artistrust-analyzer cargo tiff 0.11.3 tags/Tag#Artist#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Asciirust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Ascii#("Image-tiff".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())),
68 (Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Predictorrust-analyzer cargo tiff 0.11.3 tags/Tag#Predictor#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Shortrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Short#(1)),
69 (
70 Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::SampleFormatrust-analyzer cargo tiff 0.11.3 tags/Tag#SampleFormat#,
71 ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Listrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#List#(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
72 ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Shortrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Short#(1),
73 ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Shortrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Short#(1),
74 ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Shortrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Short#(1)
75 ])
76 ),
77 ]
78 );
79
80 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
81 decoder.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Artistrust-analyzer cargo tiff 0.11.3 tags/Tag#Artist#).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
82 ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Asciirust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Ascii#("Image-tiff".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())
83 );
84
85 let mut buffer = tiffrust-analyzer cargo tiff 0.11.3 crate/::decoderrust-analyzer cargo tiff 0.11.3 decoder/::DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::U8rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#U8#(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
86 let _layout = decoder.read_image_to_bufferrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_image_to_buffer().(&mut buffer).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
87 if let tiffrust-analyzer cargo tiff 0.11.3 crate/::decoderrust-analyzer cargo tiff 0.11.3 decoder/::DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::U8rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#U8#(img_res) = buffer {
88 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(image_data, img_res);
89 } else {
90 panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("Wrong data type");
91 }
92 }
93 }
94
95 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
96 fn encode_decode_bigrust-analyzer cargo tiff 0.11.3 encode_decode_big().() {
97 let mut image_data = 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().();
98 for x in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#100 {
99 for y in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#100u8 {
100 let val = x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add().y;
101 image_data.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(val);
102 image_data.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(val);
103 image_data.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(val);
104 }
105 }
106 let mut file = 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().(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().());
107 {
108 let mut tiff = TiffEncoderrust-analyzer cargo tiff 0.11.3 encoder/TiffEncoder#::new_bigrust-analyzer cargo tiff 0.11.3 encoder/impl#[`TiffEncoder<W, TiffKindBig>`]new_big().(&mut file).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
109
110 let mut image = tiff.new_imagerust-analyzer cargo tiff 0.11.3 encoder/impl#[`TiffEncoder<W, K>`]new_image().::<colortyperust-analyzer cargo tiff 0.11.3 encoder/colortype/::RGB8rust-analyzer cargo tiff 0.11.3 encoder/colortype/RGB8#>(100, 100).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
111 image
112 .encoderrust-analyzer cargo tiff 0.11.3 encoder/impl#[`ImageEncoder<'a, W, T, K>`]encoder().()
113 .write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Artistrust-analyzer cargo tiff 0.11.3 tags/Tag#Artist#, "Image-tiff")
114 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
115 image.write_datarust-analyzer cargo tiff 0.11.3 encoder/impl#[`ImageEncoder<'a, W, T, K>`]write_data().(&image_data).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
116 }
117 {
118 file.seekrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/impl#[`Cursor<T>`][Seek]seek().(SeekFromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/SeekFrom#::Startrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/SeekFrom#Start#(0)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
119 let mut decoder = Decoderrust-analyzer cargo tiff 0.11.3 decoder/Decoder#::newrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]new().(&mut file).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
120 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.colortyperust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]colortype().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), ColorTyperust-analyzer cargo tiff 0.11.3 ColorType#::RGBrust-analyzer cargo tiff 0.11.3 ColorType#RGB#(8));
121 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.dimensionsrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]dimensions().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), (100, 100));
122
123 let mut all_tags = decoder
124 .tag_iterrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]tag_iter().()
125 .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#::okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().)
126 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>();
127 all_tags.sort_by_keyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]sort_by_key().(|(t, _)| t.to_u16rust-analyzer cargo tiff 0.11.3 tags/impl#[Tag]to_u16().());
128 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
129 all_tags,
130 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
131 (Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::ImageWidthrust-analyzer cargo tiff 0.11.3 tags/Tag#ImageWidth#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Unsignedrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Unsigned#(100)),
132 (Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::ImageLengthrust-analyzer cargo tiff 0.11.3 tags/Tag#ImageLength#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Unsignedrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Unsigned#(100)),
133 (
134 Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::BitsPerSamplerust-analyzer cargo tiff 0.11.3 tags/Tag#BitsPerSample#,
135 ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Listrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#List#(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
136 ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Shortrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Short#(8),
137 ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Shortrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Short#(8),
138 ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Shortrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Short#(8)
139 ])
140 ),
141 (Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Compressionrust-analyzer cargo tiff 0.11.3 tags/Tag#Compression#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Shortrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Short#(1)),
142 (Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::PhotometricInterpretationrust-analyzer cargo tiff 0.11.3 tags/Tag#PhotometricInterpretation#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Shortrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Short#(2)),
143 (Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::StripOffsetsrust-analyzer cargo tiff 0.11.3 tags/Tag#StripOffsets#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::UnsignedBigrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#UnsignedBig#(27)),
144 (Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::SamplesPerPixelrust-analyzer cargo tiff 0.11.3 tags/Tag#SamplesPerPixel#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Shortrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Short#(3)),
145 (Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::RowsPerStriprust-analyzer cargo tiff 0.11.3 tags/Tag#RowsPerStrip#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Unsignedrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Unsigned#(3334)),
146 (Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::StripByteCountsrust-analyzer cargo tiff 0.11.3 tags/Tag#StripByteCounts#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::UnsignedBigrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#UnsignedBig#(30000)),
147 (Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::XResolutionrust-analyzer cargo tiff 0.11.3 tags/Tag#XResolution#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Rationalrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Rational#(1, 1)),
148 (Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::YResolutionrust-analyzer cargo tiff 0.11.3 tags/Tag#YResolution#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Rationalrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Rational#(1, 1)),
149 (Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::ResolutionUnitrust-analyzer cargo tiff 0.11.3 tags/Tag#ResolutionUnit#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Shortrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Short#(1)),
150 (Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Artistrust-analyzer cargo tiff 0.11.3 tags/Tag#Artist#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Asciirust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Ascii#("Image-tiff".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())),
151 (Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Predictorrust-analyzer cargo tiff 0.11.3 tags/Tag#Predictor#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Shortrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Short#(1)),
152 (
153 Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::SampleFormatrust-analyzer cargo tiff 0.11.3 tags/Tag#SampleFormat#,
154 ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Listrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#List#(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
155 ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Shortrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Short#(1),
156 ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Shortrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Short#(1),
157 ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Shortrust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Short#(1)
158 ])
159 ),
160 ]
161 );
162
163 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
164 decoder.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Artistrust-analyzer cargo tiff 0.11.3 tags/Tag#Artist#).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
165 ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#::Asciirust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#Ascii#("Image-tiff".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())
166 );
167 let mut buffer = tiffrust-analyzer cargo tiff 0.11.3 crate/::decoderrust-analyzer cargo tiff 0.11.3 decoder/::DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::U8rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#U8#(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
168 let _layout = decoder.read_image_to_bufferrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_image_to_buffer().(&mut buffer).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
169 if let DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::U8rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#U8#(img_res) = buffer {
170 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(image_data, img_res);
171 } else {
172 panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("Wrong data type");
173 }
174 }
175 }
176
177 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
178 fn test_encode_ifdrust-analyzer cargo tiff 0.11.3 test_encode_ifd().() {
179 let mut data = 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().(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().());
180
181 {
182 let mut tiff = TiffEncoderrust-analyzer cargo tiff 0.11.3 encoder/TiffEncoder#::newrust-analyzer cargo tiff 0.11.3 encoder/impl#[`TiffEncoder<W>`]new().(&mut data).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
183 let mut image_encoder = tiff.new_imagerust-analyzer cargo tiff 0.11.3 encoder/impl#[`TiffEncoder<W, K>`]new_image().::<colortyperust-analyzer cargo tiff 0.11.3 encoder/colortype/::Gray8rust-analyzer cargo tiff 0.11.3 encoder/colortype/Gray8#>(1, 1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
184 image_encoder.write_striprust-analyzer cargo tiff 0.11.3 encoder/impl#[`ImageEncoder<'a, W, T, K>`]write_strip().(&[1]).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
185 let encoder = image_encoder.encoderrust-analyzer cargo tiff 0.11.3 encoder/impl#[`ImageEncoder<'a, W, T, K>`]encoder().();
186
187 // Use the "reusable" tags section as per the TIFF6 spec
188 encoder.write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65000), Ifdrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Ifd#(42u32)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
189 encoder
190 .write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65001), &[Ifdrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Ifd#(100u32)][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().)
191 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
192 encoder
193 .write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65002), &[Ifdrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Ifd#(1u32), Ifdrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Ifd#(2u32), Ifdrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Ifd#(3u32)][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().)
194 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
195
196 encoder.write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65010), Ifd8rust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Ifd8#(43u64)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
197 encoder
198 .write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65011), &[Ifd8rust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Ifd8#(100u64)][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().)
199 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
200 encoder
201 .write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(
202 Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65012),
203 &[Ifd8rust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Ifd8#(1u64), Ifd8rust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Ifd8#(2u64), Ifd8rust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Ifd8#(3u64)][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().,
204 )
205 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
206 }
207
208 // Rewind the cursor for reading
209 data.set_positionrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/impl#[`Cursor<T>`]set_position().(0);
210 {
211 let mut decoder = Decoderrust-analyzer cargo tiff 0.11.3 decoder/Decoder#::newrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]new().(&mut data).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
212
213 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_u32rust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_u32().(65000), 42);
214 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_u32_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_u32_vec().(65000), [42]);
215 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_u32_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_u32_vec().(65001), [100]);
216 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_u32_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_u32_vec().(65002), [1, 2, 3]);
217
218 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_u64rust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_u64().(65010), 43);
219 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_u64_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_u64_vec().(65010), [43]);
220 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_u64_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_u64_vec().(65011), [100]);
221 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_u64_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_u64_vec().(65012), [1, 2, 3]);
222 }
223 }
224
225 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
226 /// Test that attempting to encode when the input buffer is undersized returns
227 /// an error rather than panicking.
228 /// See: https://github.com/PistonDevelopers/image-tiff/issues/35
229 fn test_encode_undersized_bufferrust-analyzer cargo tiff 0.11.3 test_encode_undersized_buffer().() {
230 let input_data = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![1, 2, 3];
231 let output = 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().();
232 let mut output_stream = 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().(output);
233 if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(mut tiff) = TiffEncoderrust-analyzer cargo tiff 0.11.3 encoder/TiffEncoder#::newrust-analyzer cargo tiff 0.11.3 encoder/impl#[`TiffEncoder<W>`]new().(&mut output_stream) {
234 let res = tiff.write_imagerust-analyzer cargo tiff 0.11.3 encoder/impl#[`TiffEncoder<W, K>`]write_image().::<colortyperust-analyzer cargo tiff 0.11.3 encoder/colortype/::RGB8rust-analyzer cargo tiff 0.11.3 encoder/colortype/RGB8#>(50, 50, &input_data);
235 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(res.is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().());
236 }
237 }
238
239 const TEST_IMAGE_DIRrust-analyzer cargo tiff 0.11.3 TEST_IMAGE_DIR.: &str = "./tests/images/";
240
241 macro_rules! test_roundtriprust-analyzer cargo tiff 0.11.3 test_roundtrip! {
242 ($name:ident, $buffer:ident, $buffer_ty:ty) => {
243 #[track_caller]
244 fn $name<C: colortype::ColorType<Inner = $buffer_ty>>(
245 file: &str,
246 expected_type: ColorType,
247 ) {
248 let path = PathBuf::from(TEST_IMAGE_DIR).join(file);
249 let img_file = File::open(path).expect("Cannot find test image!");
250 let mut decoder = Decoder::new(img_file).expect("Cannot create decoder");
251 assert_eq!(decoder.colortype().unwrap(), expected_type);
252
253 let mut buffer = tiff::decoder::DecodingResult::U8(vec![]);
254 decoder.read_image_to_buffer(&mut buffer).unwrap();
255
256 let image_data = match buffer {
257 DecodingResult::$buffer(res) => res,
258 _ => panic!("Wrong data type"),
259 };
260
261 let mut file = Cursor::new(Vec::new());
262 {
263 let mut tiff = TiffEncoder::new(&mut file).unwrap();
264
265 let (width, height) = decoder.dimensions().unwrap();
266 tiff.write_image::<C>(width, height, &image_data).unwrap();
267 }
268 file.seek(SeekFrom::Start(0)).unwrap();
269 {
270 let mut buffer = tiff::decoder::DecodingResult::U8(vec![]);
271 let mut decoder = Decoder::new(&mut file).unwrap();
272 decoder.read_image_to_buffer(&mut buffer).unwrap();
273 if let DecodingResult::$buffer(img_res) = buffer {
274 assert_eq!(*image_data, img_res);
275 } else {
276 panic!("Wrong data type");
277 }
278 }
279 }
280 };
281 }
•282 /*
283 test_roundtrip!(test_u8_roundtrip, U8, u8);
284 test_roundtrip!(test_i8_roundtrip, I8, i8);
285 test_roundtrip!(test_u16_roundtrip, U16, u16);
286 test_roundtrip!(test_i16_roundtrip, I16, i16);
287 test_roundtrip!(test_u32_roundtrip, U32, u32);
288 test_roundtrip!(test_u64_roundtrip, U64, u64);
289 test_roundtrip!(test_f32_roundtrip, F32, f32);
290 test_roundtrip!(test_f64_roundtrip, F64, f64);
291
292 #[test]
293 fn test_gray_u8_roundtrip() {
294 test_u8_roundtrip::<colortype::Gray8>("minisblack-1c-8b.tiff", ColorType::Gray(8));
295 }
296
297 #[test]
298 fn test_gray_i8_roundtrip() {
299 test_i8_roundtrip::<colortype::GrayI8>("minisblack-1c-i8b.tiff", ColorType::Gray(8));
300 }
301
302 #[test]
303 fn test_rgb_u8_roundtrip() {
304 test_u8_roundtrip::<colortype::RGB8>("rgb-3c-8b.tiff", ColorType::RGB(8));
305 }
306
307 #[test]
308 fn test_cmyk_u8_roundtrip() {
309 test_u8_roundtrip::<colortype::CMYK8>("cmyk-3c-8b.tiff", ColorType::CMYK(8));
310 }
311
312 #[test]
313 fn test_cmyka_u8_roundtrip() {
314 test_u8_roundtrip::<colortype::CMYKA8>("cmyk-4c-8b.tiff", ColorType::CMYKA(8));
315 }
316
317 #[test]
318 fn test_gray_u16_roundtrip() {
319 test_u16_roundtrip::<colortype::Gray16>("minisblack-1c-16b.tiff", ColorType::Gray(16));
320 }
321
322 #[test]
323 fn test_gray_i16_roundtrip() {
324 test_i16_roundtrip::<colortype::GrayI16>("minisblack-1c-i16b.tiff", ColorType::Gray(16));
325 }
326
327 #[test]
328 fn test_rgb_u16_roundtrip() {
329 test_u16_roundtrip::<colortype::RGB16>("rgb-3c-16b.tiff", ColorType::RGB(16));
330 }
331
332 #[test]
333 fn test_cmyk_u16_roundtrip() {
334 test_u16_roundtrip::<colortype::CMYK16>("cmyk-3c-16b.tiff", ColorType::CMYK(16));
335 }
336
337 #[test]
338 fn test_gray_u32_roundtrip() {
339 test_u32_roundtrip::<colortype::Gray32>("gradient-1c-32b.tiff", ColorType::Gray(32));
340 }
341
342 #[test]
343 fn test_rgb_u32_roundtrip() {
344 test_u32_roundtrip::<colortype::RGB32>("gradient-3c-32b.tiff", ColorType::RGB(32));
345 }
346
347 #[test]
348 fn test_gray_u64_roundtrip() {
349 test_u64_roundtrip::<colortype::Gray64>("gradient-1c-64b.tiff", ColorType::Gray(64));
350 }
351
352 #[test]
353 fn test_rgb_u64_roundtrip() {
354 test_u64_roundtrip::<colortype::RGB64>("gradient-3c-64b.tiff", ColorType::RGB(64));
355 }
356
357 #[test]
358 fn test_gray_f32_roundtrip() {
359 test_f32_roundtrip::<colortype::Gray32Float>("gradient-1c-32b-float.tiff", ColorType::Gray(32));
360 }
361
362 #[test]
363 fn test_rgb_f32_roundtrip() {
364 test_f32_roundtrip::<colortype::RGB32Float>("gradient-3c-32b-float.tiff", ColorType::RGB(32));
365 }
366
367 #[test]
368 fn test_cmyk_f32_roundtrip() {
369 test_f32_roundtrip::<colortype::CMYK32Float>("cmyk-3c-32b-float.tiff", ColorType::CMYK(32));
370 }
371
372 #[test]
373 fn test_gray_f64_roundtrip() {
374 test_f64_roundtrip::<colortype::Gray64Float>("gradient-1c-64b-float.tiff", ColorType::Gray(64));
375 }
376
377 #[test]
378 fn test_ycbcr_u8_roundtrip() {
379 test_u8_roundtrip::<colortype::YCbCr8>("tiled-jpeg-ycbcr.tif", ColorType::YCbCr(8));
380 }
•381 */
382 trait AssertDecoderust-analyzer cargo tiff 0.11.3 AssertDecode# {
383 fn assert_tag_u32rust-analyzer cargo tiff 0.11.3 AssertDecode#assert_tag_u32().(&mut self, tag: u16) -> u32;
384 fn assert_tag_u32_vecrust-analyzer cargo tiff 0.11.3 AssertDecode#assert_tag_u32_vec().(&mut self, tag: u16) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u32>;
385 fn assert_tag_i32rust-analyzer cargo tiff 0.11.3 AssertDecode#assert_tag_i32().(&mut self, tag: u16) -> i32;
386 fn assert_tag_i32_vecrust-analyzer cargo tiff 0.11.3 AssertDecode#assert_tag_i32_vec().(&mut self, tag: u16) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<i32>;
387 fn assert_tag_u64rust-analyzer cargo tiff 0.11.3 AssertDecode#assert_tag_u64().(&mut self, tag: u16) -> u64;
388 fn assert_tag_u64_vecrust-analyzer cargo tiff 0.11.3 AssertDecode#assert_tag_u64_vec().(&mut self, tag: u16) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u64>;
389 fn assert_tag_i64rust-analyzer cargo tiff 0.11.3 AssertDecode#assert_tag_i64().(&mut self, tag: u16) -> i64;
390 fn assert_tag_i64_vecrust-analyzer cargo tiff 0.11.3 AssertDecode#assert_tag_i64_vec().(&mut self, tag: u16) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<i64>;
391 }
392
393 impl<R: 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/::Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read# + 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/::Seekrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Seek#> AssertDecoderust-analyzer cargo tiff 0.11.3 AssertDecode# for Decoderrust-analyzer cargo tiff 0.11.3 decoder/Decoder#<R> {
394 fn assert_tag_u32rust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_u32().(&mut self, tag: u16) -> u32 {
395 self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(tag)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().().into_u32rust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_u32().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
396 }
397 fn assert_tag_u32_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_u32_vec().(&mut self, tag: u16) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u32> {
398 self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(tag))
399 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
400 .into_u32_vecrust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_u32_vec().()
401 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
402 }
403 fn assert_tag_i32rust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_i32().(&mut self, tag: u16) -> i32 {
404 self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(tag)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().().into_i32rust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_i32().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
405 }
406 fn assert_tag_i32_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_i32_vec().(&mut self, tag: u16) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<i32> {
407 self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(tag))
408 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
409 .into_i32_vecrust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_i32_vec().()
410 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
411 }
412 fn assert_tag_u64rust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_u64().(&mut self, tag: u16) -> u64 {
413 self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(tag)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().().into_u64rust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_u64().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
414 }
415 fn assert_tag_u64_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_u64_vec().(&mut self, tag: u16) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u64> {
416 self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(tag))
417 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
418 .into_u64_vecrust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_u64_vec().()
419 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
420 }
421 fn assert_tag_i64rust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_i64().(&mut self, tag: u16) -> i64 {
422 self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(tag)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().().into_i64rust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_i64().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
423 }
424 fn assert_tag_i64_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_i64_vec().(&mut self, tag: u16) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<i64> {
425 self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(tag))
426 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
427 .into_i64_vecrust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_i64_vec().()
428 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
429 }
430 }
431
432 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
433 fn test_multiple_byterust-analyzer cargo tiff 0.11.3 test_multiple_byte().() {
434 let mut data = 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().(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().());
435
436 {
437 let mut tiff = TiffEncoderrust-analyzer cargo tiff 0.11.3 encoder/TiffEncoder#::newrust-analyzer cargo tiff 0.11.3 encoder/impl#[`TiffEncoder<W>`]new().(&mut data).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
438 let mut image_encoder = tiff.new_imagerust-analyzer cargo tiff 0.11.3 encoder/impl#[`TiffEncoder<W, K>`]new_image().::<colortyperust-analyzer cargo tiff 0.11.3 encoder/colortype/::Gray8rust-analyzer cargo tiff 0.11.3 encoder/colortype/Gray8#>(1, 1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
439 image_encoder.write_striprust-analyzer cargo tiff 0.11.3 encoder/impl#[`ImageEncoder<'a, W, T, K>`]write_strip().(&[1]).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
440 let encoder = image_encoder.encoderrust-analyzer cargo tiff 0.11.3 encoder/impl#[`ImageEncoder<'a, W, T, K>`]encoder().();
441
442 encoder.write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65000), &[1_u8][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
443 encoder
444 .write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65001), &[1_u8, 2][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().)
445 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
446 encoder
447 .write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65002), &[1_u8, 2, 3][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().)
448 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
449 encoder
450 .write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65003), &[1_u8, 2, 3, 4][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().)
451 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
452 encoder
453 .write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65004), &[1_u8, 2, 3, 4, 5][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().)
454 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
455 }
456
457 data.set_positionrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/impl#[`Cursor<T>`]set_position().(0);
458 {
459 let mut decoder = Decoderrust-analyzer cargo tiff 0.11.3 decoder/Decoder#::newrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]new().(&mut data).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
460
461 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_u32_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_u32_vec().(65000), [1]);
462 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_u32_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_u32_vec().(65001), [1, 2]);
463 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_u32_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_u32_vec().(65002), [1, 2, 3]);
464 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_u32_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_u32_vec().(65003), [1, 2, 3, 4]);
465 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_u32_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_u32_vec().(65004), [1, 2, 3, 4, 5]);
466 }
467 }
468
469 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
470 /// Test writing signed tags from TIFF 6.0
471 fn test_signedrust-analyzer cargo tiff 0.11.3 test_signed().() {
472 let mut data = 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().(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().());
473 fn make_srationalrust-analyzer cargo tiff 0.11.3 make_srational().(i: i32) -> SRationalrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/SRational# {
474 SRationalrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/SRational# { nrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/SRational#n.: i, drust-analyzer cargo tiff 0.11.3 encoder/tiff_value/SRational#d.: 100 }
475 }
476
477 {
478 let mut tiff = TiffEncoderrust-analyzer cargo tiff 0.11.3 encoder/TiffEncoder#::newrust-analyzer cargo tiff 0.11.3 encoder/impl#[`TiffEncoder<W>`]new().(&mut data).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
479 let mut image_encoder = tiff.new_imagerust-analyzer cargo tiff 0.11.3 encoder/impl#[`TiffEncoder<W, K>`]new_image().::<colortyperust-analyzer cargo tiff 0.11.3 encoder/colortype/::Gray8rust-analyzer cargo tiff 0.11.3 encoder/colortype/Gray8#>(1, 1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
480 image_encoder.write_striprust-analyzer cargo tiff 0.11.3 encoder/impl#[`ImageEncoder<'a, W, T, K>`]write_strip().(&[1]).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
481 let encoder = image_encoder.encoderrust-analyzer cargo tiff 0.11.3 encoder/impl#[`ImageEncoder<'a, W, T, K>`]encoder().();
482
483 //Use the "reusable" tags section as per the TIFF6 spec
484 encoder.write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65000), -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().1_i8).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
485 encoder
486 .write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65001), &[-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().1_i8][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().)
487 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
488 encoder
489 .write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65002), &[-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().1_i8, 2][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().)
490 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
491 encoder
492 .write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65003), &[-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().1_i8, 2, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().3][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().)
493 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
494 encoder
495 .write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65004), &[-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().1_i8, 2, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().3, 4][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().)
496 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
497 encoder
498 .write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65005), &[-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().1_i8, 2, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().3, 4, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().5][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().)
499 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
500
501 encoder.write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65010), -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i16][Neg]neg().1_i16).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
502 encoder.write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65011), -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i16][Neg]neg().1_i16).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
503 encoder
504 .write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65012), &[-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i16][Neg]neg().1_i16, 2][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().)
505 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
506 encoder
507 .write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65013), &[-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i16][Neg]neg().1_i16, 2, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i16][Neg]neg().3][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().)
508 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
509
510 encoder.write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65020), -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1_i32).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
511 encoder
512 .write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65021), &[-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1_i32][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().)
513 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
514 encoder
515 .write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65022), &[-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1_i32, 2][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().)
516 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
517
518 encoder.write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65030), -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][Neg]neg().1_i64).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
519 encoder
520 .write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65031), &[-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][Neg]neg().1_i64][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().)
521 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
522 encoder
523 .write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65032), &[-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][Neg]neg().1_i64, 2][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().)
524 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
525
526 encoder
527 .write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65040), make_srationalrust-analyzer cargo tiff 0.11.3 make_srational().(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1))
528 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
529 encoder
530 .write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(
531 Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Unknownrust-analyzer cargo tiff 0.11.3 tags/Tag#Unknown#(65041),
532 &[make_srationalrust-analyzer cargo tiff 0.11.3 make_srational().(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1), make_srationalrust-analyzer cargo tiff 0.11.3 make_srational().(2)][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().,
533 )
534 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
535 }
536
537 //Rewind the cursor for reading
538 data.set_positionrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/impl#[`Cursor<T>`]set_position().(0);
539 {
540 let mut decoder = Decoderrust-analyzer cargo tiff 0.11.3 decoder/Decoder#::newrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]new().(&mut data).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
541
542 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_i32rust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_i32().(65000), -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1);
543 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_i32_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_i32_vec().(65001), [-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1]);
544 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_i32_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_i32_vec().(65002), [-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1, 2]);
545 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_i32_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_i32_vec().(65003), [-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1, 2, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().3]);
546 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_i32_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_i32_vec().(65004), [-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1, 2, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().3, 4]);
547 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_i32_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_i32_vec().(65005), [-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1, 2, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().3, 4, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().5],);
548
549 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_i32rust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_i32().(65010), -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1);
550 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_i32_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_i32_vec().(65011), [-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1]);
551 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_i32_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_i32_vec().(65012), [-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1, 2]);
552 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_i32_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_i32_vec().(65013), [-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1, 2, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().3]);
553
554 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_i32rust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_i32().(65020), -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1);
555 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_i32_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_i32_vec().(65021), [-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1]);
556 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_i32_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_i32_vec().(65022), [-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1, 2]);
557
558 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_i64rust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_i64().(65030), -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][Neg]neg().1);
559 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_i64_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_i64_vec().(65031), [-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][Neg]neg().1]);
560 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_i64_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_i64_vec().(65032), [-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][Neg]neg().1, 2]);
561
562 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_i32_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_i32_vec().(65040), [-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1, 100]);
563 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.assert_tag_i32_vecrust-analyzer cargo tiff 0.11.3 impl#[`Decoder<R>`][AssertDecode]assert_tag_i32_vec().(65041), [-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1_i32, 100, 2, 100]);
564 }
565 }
566
567 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
568 /// check multipage image handling
569 fn test_multipage_imagerust-analyzer cargo tiff 0.11.3 test_multipage_image().() {
570 let mut img_file = 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().(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().());
571
572 {
573 // first create a multipage image with 2 images
574 let mut img_encoder = TiffEncoderrust-analyzer cargo tiff 0.11.3 encoder/TiffEncoder#::newrust-analyzer cargo tiff 0.11.3 encoder/impl#[`TiffEncoder<W>`]new().(&mut img_file).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
575
576 // write first grayscale image (2x2 16-bit)
577 let img1: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u16> = [1, 2, 3, 4].to_vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]to_vec().();
578 img_encoder
579 .write_imagerust-analyzer cargo tiff 0.11.3 encoder/impl#[`TiffEncoder<W, K>`]write_image().::<colortyperust-analyzer cargo tiff 0.11.3 encoder/colortype/::Gray16rust-analyzer cargo tiff 0.11.3 encoder/colortype/Gray16#>(2, 2, &img1[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().)
580 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
581 // write second grayscale image (3x3 8-bit)
582 let img2: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = [9, 8, 7, 6, 5, 4, 3, 2, 1].to_vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]to_vec().();
583 img_encoder
584 .write_imagerust-analyzer cargo tiff 0.11.3 encoder/impl#[`TiffEncoder<W, K>`]write_image().::<colortyperust-analyzer cargo tiff 0.11.3 encoder/colortype/::Gray8rust-analyzer cargo tiff 0.11.3 encoder/colortype/Gray8#>(3, 3, &img2[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().)
585 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
586 }
587
588 // seek to the beginning of the file, so that it can be decoded
589 img_file.seekrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/impl#[`Cursor<T>`][Seek]seek().(SeekFromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/SeekFrom#::Startrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/SeekFrom#Start#(0)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
590
591 {
592 let mut img_decoder = Decoderrust-analyzer cargo tiff 0.11.3 decoder/Decoder#::newrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]new().(&mut img_file).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
593
594 // check the dimensions of the image in the first page
595 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(img_decoder.dimensionsrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]dimensions().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), (2, 2));
596 img_decoder.next_imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]next_image().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
597 // check the dimensions of the image in the second page
598 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(img_decoder.dimensionsrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]dimensions().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), (3, 3));
599 }
600 }
601
602 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
603 /// verify rows per strip setting
604 fn test_rows_per_striprust-analyzer cargo tiff 0.11.3 test_rows_per_strip().() {
605 let mut file = 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().(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().());
606 {
607 let mut img_encoder = TiffEncoderrust-analyzer cargo tiff 0.11.3 encoder/TiffEncoder#::newrust-analyzer cargo tiff 0.11.3 encoder/impl#[`TiffEncoder<W>`]new().(&mut file).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
608
609 let mut image = img_encoder.new_imagerust-analyzer cargo tiff 0.11.3 encoder/impl#[`TiffEncoder<W, K>`]new_image().::<colortyperust-analyzer cargo tiff 0.11.3 encoder/colortype/::Gray8rust-analyzer cargo tiff 0.11.3 encoder/colortype/Gray8#>(100, 100).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
610 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(image.next_strip_sample_countrust-analyzer cargo tiff 0.11.3 encoder/impl#[`ImageEncoder<'a, W, T, K>`]next_strip_sample_count().(), 100 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Mul<Self>`]mul(). 100);
611 image.rows_per_striprust-analyzer cargo tiff 0.11.3 encoder/impl#[`ImageEncoder<'a, W, T, K>`]rows_per_strip().(2).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
612 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(image.next_strip_sample_countrust-analyzer cargo tiff 0.11.3 encoder/impl#[`ImageEncoder<'a, W, T, K>`]next_strip_sample_count().(), 2 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Mul<Self>`]mul(). 100);
613
614 let img2: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0; 2 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 100];
615 image.write_striprust-analyzer cargo tiff 0.11.3 encoder/impl#[`ImageEncoder<'a, W, T, K>`]write_strip().(&img2[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
616 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(image.rows_per_striprust-analyzer cargo tiff 0.11.3 encoder/impl#[`ImageEncoder<'a, W, T, K>`]rows_per_strip().(5).is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().());
617 for i in 1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#50 {
618 let img2: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![i; 2 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 100];
619 image.write_striprust-analyzer cargo tiff 0.11.3 encoder/impl#[`ImageEncoder<'a, W, T, K>`]write_strip().(&img2[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
620 }
621 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(image.write_striprust-analyzer cargo tiff 0.11.3 encoder/impl#[`ImageEncoder<'a, W, T, K>`]write_strip().(&img2[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()...]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().).is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().());
622 image.finishrust-analyzer cargo tiff 0.11.3 encoder/impl#[`ImageEncoder<'a, W, T, K>`]finish().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
623 }
624
625 file.seekrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/impl#[`Cursor<T>`][Seek]seek().(SeekFromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/SeekFrom#::Startrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/SeekFrom#Start#(0)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
626 {
627 let mut decoder = Decoderrust-analyzer cargo tiff 0.11.3 decoder/Decoder#::newrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]new().(&mut file).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
628 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.get_tag_u64rust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag_u64().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::RowsPerStriprust-analyzer cargo tiff 0.11.3 tags/Tag#RowsPerStrip#).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), 2);
629 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.strip_countrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]strip_count().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), 50);
630
631 for i in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#50 {
632 let img2 = [i; 2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().100];
633 match decoder.read_chunkrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_chunk().(i as u32).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().() {
634 DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::U8rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#U8#(data) => assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&img2[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., &data[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()...]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().),
635 other => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("Incorrect strip type {other:?}"),
636 }
637 }
638 }
639 }
640
641 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
642 fn test_auxiliary_directoryrust-analyzer cargo tiff 0.11.3 test_auxiliary_directory().() {
643 const ARTISTrust-analyzer cargo tiff 0.11.3 ARTIST.: &str = "Auxiliary-tiff";
644
645 let mut data = 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().(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().());
646 let mut tiff = TiffEncoderrust-analyzer cargo tiff 0.11.3 encoder/TiffEncoder#::newrust-analyzer cargo tiff 0.11.3 encoder/impl#[`TiffEncoder<W>`]new().(&mut data).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
647
648 {
649 let mut image_encoder = tiff.new_imagerust-analyzer cargo tiff 0.11.3 encoder/impl#[`TiffEncoder<W, K>`]new_image().::<colortyperust-analyzer cargo tiff 0.11.3 encoder/colortype/::Gray8rust-analyzer cargo tiff 0.11.3 encoder/colortype/Gray8#>(1, 1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
650 image_encoder.write_striprust-analyzer cargo tiff 0.11.3 encoder/impl#[`ImageEncoder<'a, W, T, K>`]write_strip().(&[1]).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
651 }
652
653 let exif = {
654 let mut extra = tiff.extra_directoryrust-analyzer cargo tiff 0.11.3 encoder/impl#[`TiffEncoder<W, K>`]extra_directory().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
655 extra.write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Artistrust-analyzer cargo tiff 0.11.3 tags/Tag#Artist#, ARTISTrust-analyzer cargo tiff 0.11.3 ARTIST.).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
656 extra.finish_with_offsetsrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]finish_with_offsets().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
657 };
658
659 {
660 let mut image_encoder = tiff.new_imagerust-analyzer cargo tiff 0.11.3 encoder/impl#[`TiffEncoder<W, K>`]new_image().::<colortyperust-analyzer cargo tiff 0.11.3 encoder/colortype/::Gray8rust-analyzer cargo tiff 0.11.3 encoder/colortype/Gray8#>(2, 1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
661 image_encoder.write_striprust-analyzer cargo tiff 0.11.3 encoder/impl#[`ImageEncoder<'a, W, T, K>`]write_strip().(&[1, 2]).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
662 let encoder = image_encoder.encoderrust-analyzer cargo tiff 0.11.3 encoder/impl#[`ImageEncoder<'a, W, T, K>`]encoder().();
663 encoder.write_tagrust-analyzer cargo tiff 0.11.3 encoder/impl#[`DirectoryEncoder<'a, W, K>`]write_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::ExifDirectoryrust-analyzer cargo tiff 0.11.3 tags/Tag#ExifDirectory#, exif.offsetrust-analyzer cargo tiff 0.11.3 encoder/DirectoryOffset#offset.).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
664 }
665
666 data.set_positionrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/impl#[`Cursor<T>`]set_position().(0);
667 let mut decoder = Decoderrust-analyzer cargo tiff 0.11.3 decoder/Decoder#::newrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]new().(&mut data).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
668
669 {
670 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.dimensionsrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]dimensions().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), (1, 1));
671 let _ = decoder.read_imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_image().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
672 }
673
674 {
675 decoder.next_imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]next_image().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
676 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(decoder.dimensionsrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]dimensions().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), (2, 1));
677 let _ = decoder.read_imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_image().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
678
679 let exif_location = decoder
680 .get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::ExifDirectoryrust-analyzer cargo tiff 0.11.3 tags/Tag#ExifDirectory#)
681 .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("second directory missing Exif")
682 .into_ifd_pointerrust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_ifd_pointer().()
683 .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("exif directory is not an IFD pointer");
684
685 let exif = decoder.read_directoryrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_directory().(exif_location).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
686
687 let artist = decoder
688 .read_directory_tagsrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_directory_tags().(&exif)
689 .get_tag_ascii_stringrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]get_tag_ascii_string().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::Artistrust-analyzer cargo tiff 0.11.3 tags/Tag#Artist#)
690 .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("EXIF directory missing artist tag");
691 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(artist, ARTISTrust-analyzer cargo tiff 0.11.3 ARTIST.);
692 }
693 }