Debian Codegraph @

src/encoder/tiff_value.rs

raw symbols SCIP
1 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{borrowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/::Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#, iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#, slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/::from_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_ref().};
2
3 use craterust-analyzer cargo tiff 0.11.3 crate/::{bytecastrust-analyzer cargo tiff 0.11.3 bytecast/, tagsrust-analyzer cargo tiff 0.11.3 tags/, tagsrust-analyzer cargo tiff 0.11.3 tags/::Typerust-analyzer cargo tiff 0.11.3 tags/Type#, TiffErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#, TiffFormatErrorrust-analyzer cargo tiff 0.11.3 error/TiffFormatError#, TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#};
4
5 use superrust-analyzer cargo tiff 0.11.3 encoder/::writerrust-analyzer cargo tiff 0.11.3 encoder/writer/::TiffWriterrust-analyzer cargo tiff 0.11.3 encoder/writer/TiffWriter#;
6
7 /// Trait for types that can be encoded in a tiff file
8 #[diagnostic::on_unimplemented(
9 message = "the type `{Self}` does not implement `TiffValue`",
10 note = "the trait is implemented for primitive types (`u8`, `i16`, `f32`, etc.)",
11 note = "the trait is implemented for shared references to values",
12 note = "the trait is implemented for slices, pass them by reference (e.g. `&[u8]`)",
13 note = "the trait is implemented for arrays if it is implemented for a slice",
14 note = "values in a `Vec` or `Box` should be dereferenced, e.g. `&vec[..]`"
15 )]
16 pub trait TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# {
17 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue#BYTE_LEN.: u8;
18 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue#FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type#;
19
20 // FIXME: If we want this to mean 'count' in the sense of `Entry` it should return `u32` or
21 // `u64`, probably the latter with `convert_offset` taking care of the check against `u32::MAX`
22 // for classic tiff.
23 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue#count().(&self) -> usize;
24
25 fn bytesrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue#bytes().(&self) -> usize {
26 self.countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue#count().() 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().usize::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[usize][`From<u8>`]from().(Self::BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue#BYTE_LEN.)
27 }
28
29 /// Access this value as an contiguous sequence of bytes.
30 /// If their is no trivial representation, allocate it on the heap.
31 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue#data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]>;
32
33 /// Write this value to a TiffWriter.
34 /// While the default implementation will work in all cases, it may require unnecessary allocations.
35 /// The written bytes of any custom implementation MUST be the same as yielded by `self.data()`.
36 fn writerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue#write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, writer: &mut TiffWriterrust-analyzer cargo tiff 0.11.3 encoder/writer/TiffWriter#<W>) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> {
37 writer.write_bytesrust-analyzer cargo tiff 0.11.3 encoder/writer/impl#[`TiffWriter<W>`]write_bytes().(&self.datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue#data().())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
38 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
39 }
40 }
41
42 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for [u8] {
43 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[u8]`][TiffValue]BYTE_LEN.: u8 = 1;
44 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[u8]`][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::BYTErust-analyzer cargo tiff 0.11.3 tags/Type#BYTE#;
45
46 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[u8]`][TiffValue]count().(&self) -> usize {
47 self.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()
48 }
49
50 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[u8]`][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
51 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(self)
52 }
53 }
54
55 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for [i8] {
56 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[i8]`][TiffValue]BYTE_LEN.: u8 = 1;
57 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[i8]`][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::SBYTErust-analyzer cargo tiff 0.11.3 tags/Type#SBYTE#;
58
59 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[i8]`][TiffValue]count().(&self) -> usize {
60 self.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()
61 }
62
63 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[i8]`][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
64 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::i8_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/i8_as_ne_bytes().(self))
65 }
66 }
67
68 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for [u16] {
69 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[u16]`][TiffValue]BYTE_LEN.: u8 = 2;
70 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[u16]`][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::SHORTrust-analyzer cargo tiff 0.11.3 tags/Type#SHORT#;
71
72 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[u16]`][TiffValue]count().(&self) -> usize {
73 self.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()
74 }
75
76 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[u16]`][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
77 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::u16_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/u16_as_ne_bytes().(self))
78 }
79 }
80
81 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for [i16] {
82 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[i16]`][TiffValue]BYTE_LEN.: u8 = 2;
83 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[i16]`][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::SSHORTrust-analyzer cargo tiff 0.11.3 tags/Type#SSHORT#;
84
85 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[i16]`][TiffValue]count().(&self) -> usize {
86 self.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()
87 }
88
89 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[i16]`][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
90 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::i16_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/i16_as_ne_bytes().(self))
91 }
92 }
93
94 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for [u32] {
95 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[u32]`][TiffValue]BYTE_LEN.: u8 = 4;
96 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[u32]`][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::LONGrust-analyzer cargo tiff 0.11.3 tags/Type#LONG#;
97
98 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[u32]`][TiffValue]count().(&self) -> usize {
99 self.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()
100 }
101
102 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[u32]`][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
103 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::u32_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/u32_as_ne_bytes().(self))
104 }
105 }
106
107 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for [i32] {
108 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[i32]`][TiffValue]BYTE_LEN.: u8 = 4;
109 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[i32]`][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::SLONGrust-analyzer cargo tiff 0.11.3 tags/Type#SLONG#;
110
111 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[i32]`][TiffValue]count().(&self) -> usize {
112 self.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()
113 }
114
115 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[i32]`][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
116 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::i32_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/i32_as_ne_bytes().(self))
117 }
118 }
119
120 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for [u64] {
121 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[u64]`][TiffValue]BYTE_LEN.: u8 = 8;
122 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[u64]`][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::LONG8rust-analyzer cargo tiff 0.11.3 tags/Type#LONG8#;
123
124 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[u64]`][TiffValue]count().(&self) -> usize {
125 self.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()
126 }
127
128 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[u64]`][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
129 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::u64_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/u64_as_ne_bytes().(self))
130 }
131 }
132
133 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for [i64] {
134 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[i64]`][TiffValue]BYTE_LEN.: u8 = 8;
135 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[i64]`][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::SLONG8rust-analyzer cargo tiff 0.11.3 tags/Type#SLONG8#;
136
137 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[i64]`][TiffValue]count().(&self) -> usize {
138 self.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()
139 }
140
141 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[i64]`][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
142 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::i64_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/i64_as_ne_bytes().(self))
143 }
144 }
145
146 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for [f32] {
147 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[f32]`][TiffValue]BYTE_LEN.: u8 = 4;
148 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[f32]`][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::FLOATrust-analyzer cargo tiff 0.11.3 tags/Type#FLOAT#;
149
150 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[f32]`][TiffValue]count().(&self) -> usize {
151 self.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()
152 }
153
154 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[f32]`][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
155 // We write using native endian so this should be safe
156 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::f32_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/f32_as_ne_bytes().(self))
157 }
158 }
159
160 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for [f64] {
161 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[f64]`][TiffValue]BYTE_LEN.: u8 = 8;
162 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[f64]`][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::DOUBLErust-analyzer cargo tiff 0.11.3 tags/Type#DOUBLE#;
163
164 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[f64]`][TiffValue]count().(&self) -> usize {
165 self.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()
166 }
167
168 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[f64]`][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
169 // We write using native endian so this should be safe
170 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::f64_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/f64_as_ne_bytes().(self))
171 }
172 }
173
174 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for u8 {
175 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[u8][TiffValue]BYTE_LEN.: u8 = 1;
176 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[u8][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::BYTErust-analyzer cargo tiff 0.11.3 tags/Type#BYTE#;
177
178 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[u8][TiffValue]count().(&self) -> usize {
179 1
180 }
181
182 fn writerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[u8][TiffValue]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, writer: &mut TiffWriterrust-analyzer cargo tiff 0.11.3 encoder/writer/TiffWriter#<W>) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> {
183 writer.write_u8rust-analyzer cargo tiff 0.11.3 encoder/writer/impl#[`TiffWriter<W>`]write_u8().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
184 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
185 }
186
187 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[u8][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
188 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(from_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_ref().(self))
189 }
190 }
191
192 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for i8 {
193 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[i8][TiffValue]BYTE_LEN.: u8 = 1;
194 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[i8][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::SBYTErust-analyzer cargo tiff 0.11.3 tags/Type#SBYTE#;
195
196 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[i8][TiffValue]count().(&self) -> usize {
197 1
198 }
199
200 fn writerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[i8][TiffValue]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, writer: &mut TiffWriterrust-analyzer cargo tiff 0.11.3 encoder/writer/TiffWriter#<W>) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> {
201 writer.write_i8rust-analyzer cargo tiff 0.11.3 encoder/writer/impl#[`TiffWriter<W>`]write_i8().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
202 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
203 }
204
205 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[i8][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
206 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::i8_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/i8_as_ne_bytes().(from_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_ref().(self)))
207 }
208 }
209
210 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for u16 {
211 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[u16][TiffValue]BYTE_LEN.: u8 = 2;
212 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[u16][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::SHORTrust-analyzer cargo tiff 0.11.3 tags/Type#SHORT#;
213
214 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[u16][TiffValue]count().(&self) -> usize {
215 1
216 }
217
218 fn writerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[u16][TiffValue]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, writer: &mut TiffWriterrust-analyzer cargo tiff 0.11.3 encoder/writer/TiffWriter#<W>) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> {
219 writer.write_u16rust-analyzer cargo tiff 0.11.3 encoder/writer/impl#[`TiffWriter<W>`]write_u16().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
220 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
221 }
222
223 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[u16][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
224 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::u16_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/u16_as_ne_bytes().(from_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_ref().(self)))
225 }
226 }
227
228 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for i16 {
229 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[i16][TiffValue]BYTE_LEN.: u8 = 2;
230 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[i16][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::SSHORTrust-analyzer cargo tiff 0.11.3 tags/Type#SSHORT#;
231
232 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[i16][TiffValue]count().(&self) -> usize {
233 1
234 }
235
236 fn writerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[i16][TiffValue]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, writer: &mut TiffWriterrust-analyzer cargo tiff 0.11.3 encoder/writer/TiffWriter#<W>) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> {
237 writer.write_i16rust-analyzer cargo tiff 0.11.3 encoder/writer/impl#[`TiffWriter<W>`]write_i16().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
238 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
239 }
240
241 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[i16][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
242 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::i16_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/i16_as_ne_bytes().(from_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_ref().(self)))
243 }
244 }
245
246 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for u32 {
247 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[u32][TiffValue]BYTE_LEN.: u8 = 4;
248 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[u32][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::LONGrust-analyzer cargo tiff 0.11.3 tags/Type#LONG#;
249
250 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[u32][TiffValue]count().(&self) -> usize {
251 1
252 }
253
254 fn writerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[u32][TiffValue]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, writer: &mut TiffWriterrust-analyzer cargo tiff 0.11.3 encoder/writer/TiffWriter#<W>) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> {
255 writer.write_u32rust-analyzer cargo tiff 0.11.3 encoder/writer/impl#[`TiffWriter<W>`]write_u32().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
256 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
257 }
258
259 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[u32][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
260 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::u32_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/u32_as_ne_bytes().(from_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_ref().(self)))
261 }
262 }
263
264 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for i32 {
265 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[i32][TiffValue]BYTE_LEN.: u8 = 4;
266 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[i32][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::SLONGrust-analyzer cargo tiff 0.11.3 tags/Type#SLONG#;
267
268 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[i32][TiffValue]count().(&self) -> usize {
269 1
270 }
271
272 fn writerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[i32][TiffValue]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, writer: &mut TiffWriterrust-analyzer cargo tiff 0.11.3 encoder/writer/TiffWriter#<W>) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> {
273 writer.write_i32rust-analyzer cargo tiff 0.11.3 encoder/writer/impl#[`TiffWriter<W>`]write_i32().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
274 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
275 }
276
277 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[i32][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
278 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::i32_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/i32_as_ne_bytes().(from_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_ref().(self)))
279 }
280 }
281
282 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for u64 {
283 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[u64][TiffValue]BYTE_LEN.: u8 = 8;
284 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[u64][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::LONG8rust-analyzer cargo tiff 0.11.3 tags/Type#LONG8#;
285
286 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[u64][TiffValue]count().(&self) -> usize {
287 1
288 }
289
290 fn writerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[u64][TiffValue]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, writer: &mut TiffWriterrust-analyzer cargo tiff 0.11.3 encoder/writer/TiffWriter#<W>) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> {
291 writer.write_u64rust-analyzer cargo tiff 0.11.3 encoder/writer/impl#[`TiffWriter<W>`]write_u64().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
292 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
293 }
294
295 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[u64][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
296 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::u64_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/u64_as_ne_bytes().(from_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_ref().(self)))
297 }
298 }
299
300 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for i64 {
301 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[i64][TiffValue]BYTE_LEN.: u8 = 8;
302 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[i64][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::SLONG8rust-analyzer cargo tiff 0.11.3 tags/Type#SLONG8#;
303
304 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[i64][TiffValue]count().(&self) -> usize {
305 1
306 }
307
308 fn writerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[i64][TiffValue]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, writer: &mut TiffWriterrust-analyzer cargo tiff 0.11.3 encoder/writer/TiffWriter#<W>) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> {
309 writer.write_i64rust-analyzer cargo tiff 0.11.3 encoder/writer/impl#[`TiffWriter<W>`]write_i64().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
310 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
311 }
312
313 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[i64][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
314 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::i64_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/i64_as_ne_bytes().(from_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_ref().(self)))
315 }
316 }
317
318 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for f32 {
319 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[f32][TiffValue]BYTE_LEN.: u8 = 4;
320 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[f32][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::FLOATrust-analyzer cargo tiff 0.11.3 tags/Type#FLOAT#;
321
322 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[f32][TiffValue]count().(&self) -> usize {
323 1
324 }
325
326 fn writerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[f32][TiffValue]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, writer: &mut TiffWriterrust-analyzer cargo tiff 0.11.3 encoder/writer/TiffWriter#<W>) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> {
327 writer.write_f32rust-analyzer cargo tiff 0.11.3 encoder/writer/impl#[`TiffWriter<W>`]write_f32().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
328 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
329 }
330
331 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[f32][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
332 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::f32_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/f32_as_ne_bytes().(from_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_ref().(self)))
333 }
334 }
335
336 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for f64 {
337 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[f64][TiffValue]BYTE_LEN.: u8 = 8;
338 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[f64][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::DOUBLErust-analyzer cargo tiff 0.11.3 tags/Type#DOUBLE#;
339
340 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[f64][TiffValue]count().(&self) -> usize {
341 1
342 }
343
344 fn writerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[f64][TiffValue]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, writer: &mut TiffWriterrust-analyzer cargo tiff 0.11.3 encoder/writer/TiffWriter#<W>) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> {
345 writer.write_f64rust-analyzer cargo tiff 0.11.3 encoder/writer/impl#[`TiffWriter<W>`]write_f64().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
346 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
347 }
348
349 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[f64][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
350 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::f64_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/f64_as_ne_bytes().(from_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_ref().(self)))
351 }
352 }
353
354 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for Ifdrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Ifd# {
355 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[Ifd][TiffValue]BYTE_LEN.: u8 = 4;
356 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[Ifd][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::IFDrust-analyzer cargo tiff 0.11.3 tags/Type#IFD#;
357
358 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[Ifd][TiffValue]count().(&self) -> usize {
359 1
360 }
361
362 fn writerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[Ifd][TiffValue]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, writer: &mut TiffWriterrust-analyzer cargo tiff 0.11.3 encoder/writer/TiffWriter#<W>) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> {
363 writer.write_u32rust-analyzer cargo tiff 0.11.3 encoder/writer/impl#[`TiffWriter<W>`]write_u32().(self.0rust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Ifd#0.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
364 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
365 }
366
367 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[Ifd][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
368 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::u32_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/u32_as_ne_bytes().(from_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_ref().(&self.0rust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Ifd#0.)))
369 }
370 }
371
372 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for Ifd8rust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Ifd8# {
373 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[Ifd8][TiffValue]BYTE_LEN.: u8 = 8;
374 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[Ifd8][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::IFD8rust-analyzer cargo tiff 0.11.3 tags/Type#IFD8#;
375
376 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[Ifd8][TiffValue]count().(&self) -> usize {
377 1
378 }
379
380 fn writerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[Ifd8][TiffValue]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, writer: &mut TiffWriterrust-analyzer cargo tiff 0.11.3 encoder/writer/TiffWriter#<W>) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> {
381 writer.write_u64rust-analyzer cargo tiff 0.11.3 encoder/writer/impl#[`TiffWriter<W>`]write_u64().(self.0rust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Ifd8#0.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
382 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
383 }
384
385 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[Ifd8][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
386 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::u64_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/u64_as_ne_bytes().(from_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_ref().(&self.0rust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Ifd8#0.)))
387 }
388 }
389
390 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for Rationalrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Rational# {
391 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[Rational][TiffValue]BYTE_LEN.: u8 = 8;
392 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[Rational][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::RATIONALrust-analyzer cargo tiff 0.11.3 tags/Type#RATIONAL#;
393
394 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[Rational][TiffValue]count().(&self) -> usize {
395 1
396 }
397
398 fn writerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[Rational][TiffValue]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, writer: &mut TiffWriterrust-analyzer cargo tiff 0.11.3 encoder/writer/TiffWriter#<W>) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> {
399 writer.write_u32rust-analyzer cargo tiff 0.11.3 encoder/writer/impl#[`TiffWriter<W>`]write_u32().(self.nrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Rational#n.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
400 writer.write_u32rust-analyzer cargo tiff 0.11.3 encoder/writer/impl#[`TiffWriter<W>`]write_u32().(self.drust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Rational#d.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
401 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
402 }
403
404 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[Rational][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
405 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Owned#({
406 let first_dword = bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::u32_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/u32_as_ne_bytes().(from_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_ref().(&self.nrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Rational#n.));
407 let second_dword = bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::u32_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/u32_as_ne_bytes().(from_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_ref().(&self.drust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Rational#d.));
408 [first_dword, second_dword].concatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]concat().()
409 })
410 }
411 }
412
413 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for SRationalrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/SRational# {
414 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[SRational][TiffValue]BYTE_LEN.: u8 = 8;
415 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[SRational][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::SRATIONALrust-analyzer cargo tiff 0.11.3 tags/Type#SRATIONAL#;
416
417 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[SRational][TiffValue]count().(&self) -> usize {
418 1
419 }
420
421 fn writerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[SRational][TiffValue]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, writer: &mut TiffWriterrust-analyzer cargo tiff 0.11.3 encoder/writer/TiffWriter#<W>) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> {
422 writer.write_i32rust-analyzer cargo tiff 0.11.3 encoder/writer/impl#[`TiffWriter<W>`]write_i32().(self.nrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/SRational#n.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
423 writer.write_i32rust-analyzer cargo tiff 0.11.3 encoder/writer/impl#[`TiffWriter<W>`]write_i32().(self.drust-analyzer cargo tiff 0.11.3 encoder/tiff_value/SRational#d.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
424 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
425 }
426
427 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[SRational][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
428 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Owned#({
429 let first_dword = bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::i32_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/i32_as_ne_bytes().(from_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_ref().(&self.nrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/SRational#n.));
430 let second_dword = bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::i32_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/i32_as_ne_bytes().(from_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_ref().(&self.drust-analyzer cargo tiff 0.11.3 encoder/tiff_value/SRational#d.));
431 [first_dword, second_dword].concatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]concat().()
432 })
433 }
434 }
435
436 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for str {
437 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[str][TiffValue]BYTE_LEN.: u8 = 1;
438 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[str][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::ASCIIrust-analyzer cargo tiff 0.11.3 tags/Type#ASCII#;
439
440 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[str][TiffValue]count().(&self) -> usize {
441 self.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1
442 }
443
444 fn writerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[str][TiffValue]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, writer: &mut TiffWriterrust-analyzer cargo tiff 0.11.3 encoder/writer/TiffWriter#<W>) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> {
445 if self.is_asciirust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_ascii().() && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]bytes().().anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Bytes<'_>`][Iterator]any().(|b| b rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().0) {
446 writer.write_bytesrust-analyzer cargo tiff 0.11.3 encoder/writer/impl#[`TiffWriter<W>`]write_bytes().(self.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
447 writer.write_u8rust-analyzer cargo tiff 0.11.3 encoder/writer/impl#[`TiffWriter<W>`]write_u8().(0)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
448 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
449 } else {
450 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(TiffErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#::FormatErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#FormatError#(TiffFormatErrorrust-analyzer cargo tiff 0.11.3 error/TiffFormatError#::InvalidTagrust-analyzer cargo tiff 0.11.3 error/TiffFormatError#InvalidTag#))
451 }
452 }
453
454 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[str][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
455 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Owned#({
456 if self.is_asciirust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_ascii().() && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]bytes().().anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Bytes<'_>`][Iterator]any().(|b| b rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().0) {
457 let bytes: &[u8] = self.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().();
458 [bytes, &[0]].concatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]concat().()
459 } else {
460 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]
461 }
462 })
463 }
464 }
465
466 // FIXME: held up on reading the discriminant for all but the unknown variant.
467 //
468 // It needs to have `repr(u16)` to have a defined layout and then we may read the tag from its
469 // value representation by casting a u16 pointer to a pointer to the enum type.
470 // unsafe { *<*const _>::from(self).cast::<u16>() }
471 // But that is quite unsafe and needs careful review to maintain the safety requirements. Maybe we
472 // could get `bytemuck` to add a trait for this (it has `TransparentWrapper`) with a derive for
473 // enum types that have an explicit repr.
474 //
475 // This would allow returning borrowed data in more cases. For all types without an unknown, in all
476 // cases including as slices, and for all types with and unknown variant when we have a single
477 // value (either returning a borrowed discriminant or a borrowed value within `Unknown`).
478 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for tagsrust-analyzer cargo tiff 0.11.3 tags/::CompressionMethodrust-analyzer cargo tiff 0.11.3 tags/CompressionMethod# {
479 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`tags::CompressionMethod`][TiffValue]BYTE_LEN.: u8 = <u16 as TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue#>::BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[u16][TiffValue]BYTE_LEN.;
480 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`tags::CompressionMethod`][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::SHORTrust-analyzer cargo tiff 0.11.3 tags/Type#SHORT#;
481
482 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`tags::CompressionMethod`][TiffValue]count().(&self) -> usize {
483 1
484 }
485
486 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`tags::CompressionMethod`][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
487 let bytes = self.to_u16rust-analyzer cargo tiff 0.11.3 tags/impl#[CompressionMethod]to_u16().().to_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]to_ne_bytes().();
488 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Owned#(bytes.to_vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]to_vec().())
489 }
490 }
491
492 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for tagsrust-analyzer cargo tiff 0.11.3 tags/::PhotometricInterpretationrust-analyzer cargo tiff 0.11.3 tags/PhotometricInterpretation# {
493 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`tags::PhotometricInterpretation`][TiffValue]BYTE_LEN.: u8 = <u16 as TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue#>::BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[u16][TiffValue]BYTE_LEN.;
494 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`tags::PhotometricInterpretation`][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::SHORTrust-analyzer cargo tiff 0.11.3 tags/Type#SHORT#;
495
496 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`tags::PhotometricInterpretation`][TiffValue]count().(&self) -> usize {
497 1
498 }
499
500 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`tags::PhotometricInterpretation`][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
501 self.to_u16rust-analyzer cargo tiff 0.11.3 tags/impl#[PhotometricInterpretation]to_u16().().to_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]to_ne_bytes().().to_vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]to_vec().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()
502 }
503 }
504
505 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for tagsrust-analyzer cargo tiff 0.11.3 tags/::PlanarConfigurationrust-analyzer cargo tiff 0.11.3 tags/PlanarConfiguration# {
506 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`tags::PlanarConfiguration`][TiffValue]BYTE_LEN.: u8 = 2;
507 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`tags::PlanarConfiguration`][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::SHORTrust-analyzer cargo tiff 0.11.3 tags/Type#SHORT#;
508
509 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`tags::PlanarConfiguration`][TiffValue]count().(&self) -> usize {
510 1
511 }
512
513 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`tags::PlanarConfiguration`][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
514 self.to_u16rust-analyzer cargo tiff 0.11.3 tags/impl#[PlanarConfiguration]to_u16().().to_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]to_ne_bytes().().to_vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]to_vec().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()
515 }
516 }
517
518 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for tagsrust-analyzer cargo tiff 0.11.3 tags/::Predictorrust-analyzer cargo tiff 0.11.3 tags/Predictor# {
519 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`tags::Predictor`][TiffValue]BYTE_LEN.: u8 = <u16 as TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue#>::BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[u16][TiffValue]BYTE_LEN.;
520 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`tags::Predictor`][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::SHORTrust-analyzer cargo tiff 0.11.3 tags/Type#SHORT#;
521
522 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`tags::Predictor`][TiffValue]count().(&self) -> usize {
523 1
524 }
525
526 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`tags::Predictor`][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
527 self.to_u16rust-analyzer cargo tiff 0.11.3 tags/impl#[Predictor]to_u16().().to_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]to_ne_bytes().().to_vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]to_vec().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()
528 }
529 }
530
531 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for tagsrust-analyzer cargo tiff 0.11.3 tags/::ResolutionUnitrust-analyzer cargo tiff 0.11.3 tags/ResolutionUnit# {
532 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`tags::ResolutionUnit`][TiffValue]BYTE_LEN.: u8 = <u16 as TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue#>::BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[u16][TiffValue]BYTE_LEN.;
533 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`tags::ResolutionUnit`][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::SHORTrust-analyzer cargo tiff 0.11.3 tags/Type#SHORT#;
534
535 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`tags::ResolutionUnit`][TiffValue]count().(&self) -> usize {
536 1
537 }
538
539 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`tags::ResolutionUnit`][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
540 self.to_u16rust-analyzer cargo tiff 0.11.3 tags/impl#[ResolutionUnit]to_u16().().to_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]to_ne_bytes().().to_vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]to_vec().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()
541 }
542 }
543
544 /// This is implemented for slices as the `SampleFormat` tag takes a count of `N`.
545 ///
546 /// Use `core::slice::from_ref` if you really need to write a single element.
547 ///
548 /// See: <https://web.archive.org/web/20191120220815/https://www.awaresystems.be/imaging/tiff/tifftags/sampleformat.html>
549 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for [tagsrust-analyzer cargo tiff 0.11.3 tags/::SampleFormatrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#] {
550 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[tags::SampleFormat]`][TiffValue]BYTE_LEN.: u8 = <u16 as TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue#>::BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[u16][TiffValue]BYTE_LEN.;
551 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[tags::SampleFormat]`][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::SHORTrust-analyzer cargo tiff 0.11.3 tags/Type#SHORT#;
552
553 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[tags::SampleFormat]`][TiffValue]count().(&self) -> usize {
554 self.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()
555 }
556
557 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[tags::SampleFormat]`][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
558 let mut buf: 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 vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(self.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core 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().2);
559 for x in self {
560 buf.extend_from_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]extend_from_slice().(&x.to_u16rust-analyzer cargo tiff 0.11.3 tags/impl#[SampleFormat]to_u16().().to_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]to_ne_bytes().());
561 }
562 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Owned#(buf)
563 }
564 }
565
566 /// This is implemented for slices as the `ExtraSamples` tag takes a count of `N`.
567 ///
568 /// Use `core::slice::from_ref` if you really need to write a single element.
569 ///
570 /// See: <https://web.archive.org/web/20191120220815/https://www.awaresystems.be/imaging/tiff/tifftags/extrasamples.html>
571 impl TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for [tagsrust-analyzer cargo tiff 0.11.3 tags/::ExtraSamplesrust-analyzer cargo tiff 0.11.3 tags/ExtraSamples#] {
572 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[tags::ExtraSamples]`][TiffValue]BYTE_LEN.: u8 = <u16 as TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue#>::BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[u16][TiffValue]BYTE_LEN.;
573 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[tags::ExtraSamples]`][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = Typerust-analyzer cargo tiff 0.11.3 tags/Type#::SHORTrust-analyzer cargo tiff 0.11.3 tags/Type#SHORT#;
574
575 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[tags::ExtraSamples]`][TiffValue]count().(&self) -> usize {
576 self.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()
577 }
578
579 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[tags::ExtraSamples]`][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
580 let mut buf: 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 vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(self.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core 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().2);
581 for x in self {
582 buf.extend_from_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]extend_from_slice().(&x.to_u16rust-analyzer cargo tiff 0.11.3 tags/impl#[ExtraSamples]to_u16().().to_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]to_ne_bytes().());
583 }
584 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Owned#(buf)
585 }
586 }
587
588 // If you pass `&Vec<_>` then you'd get at first sight the complaint:
589 //
590 // `Vec<T>` does not implement `TiffValue`
591 //
592 // and a list of implementations of `TiffValue` that are quite unrelated. That is not very helpful.
593 // We do not *want* `Vec` to implement the trait as an owning type, instead you should pass a
594 // reference to a slice. The error message is further customized in the diagnostics of the trait.
595 #[diagnostic::do_not_recommend]
596 impl<T: TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#> TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for &'_ T {
597 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`&T`][TiffValue]BYTE_LEN.: u8 = T::BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue#BYTE_LEN.;
598 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`&T`][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = T::FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue#FIELD_TYPE.;
599
600 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`&T`][TiffValue]count().(&self) -> usize {
601 (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self).countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue#count().()
602 }
603
604 fn writerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`&T`][TiffValue]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, writer: &mut TiffWriterrust-analyzer cargo tiff 0.11.3 encoder/writer/TiffWriter#<W>) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> {
605 (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self).writerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue#write().(writer)
606 }
607
608 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`&T`][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
609 T::datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue#data().(self)
610 }
611 }
612
613 /// An array is treated like a slice of the same length.
614 impl<T, const N: usize> TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue# for [T; N]
615 where
616 [T]: TiffValuerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue#,
617 {
618 const BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[T; N]`][TiffValue]BYTE_LEN.: u8 = <[T]>::BYTE_LENrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue#BYTE_LEN.;
619 const FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[T; N]`][TiffValue]FIELD_TYPE.: Typerust-analyzer cargo tiff 0.11.3 tags/Type# = <[T]>::FIELD_TYPErust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue#FIELD_TYPE.;
620
621 fn countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[T; N]`][TiffValue]count().(&self) -> usize {
622 self.as_slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`]as_slice().().countrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue#count().()
623 }
624
625 fn writerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[T; N]`][TiffValue]write().<W: Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#>(&self, writer: &mut TiffWriterrust-analyzer cargo tiff 0.11.3 encoder/writer/TiffWriter#<W>) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> {
626 self.as_slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`]as_slice().().writerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue#write().(writer)
627 }
628
629 fn datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl#[`[T; N]`][TiffValue]data().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, [u8]> {
630 self.as_slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`]as_slice().().datarust-analyzer cargo tiff 0.11.3 encoder/tiff_value/TiffValue#data().()
631 }
632 }
633
634 macro_rules! impl_tiff_value_for_contiguous_sequencerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl_tiff_value_for_contiguous_sequence! {
635 ($inner_type:ty; $bytes:expr; $field_type:expr) => {
636 impl $crate::encoder::TiffValue for [$inner_type] {
637 const BYTE_LEN: u8 = $bytes;
638 const FIELD_TYPE: Type = $field_type;
639
640 fn count(&self) -> usize {
641 self.len()
642 }
643
644 fn write<W: Write>(&self, writer: &mut TiffWriter<W>) -> TiffResult<()> {
645 for x in self {
646 x.write(writer)?;
647 }
648 Ok(())
649 }
650
651 fn data(&self) -> Cow<'_, [u8]> {
652 let mut buf: Vec<u8> = Vec::with_capacity(Self::BYTE_LEN as usize * self.len());
653 for x in self {
654 buf.extend_from_slice(&x.data());
655 }
656 Cow::Owned(buf)
657 }
658 }
659 };
660 }
661
662 impl_tiff_value_for_contiguous_sequencerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl_tiff_value_for_contiguous_sequence!!(Ifdrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Ifd#; 4; Typerust-analyzer cargo tiff 0.11.3 tags/Type#::IFDrust-analyzer cargo tiff 0.11.3 tags/Type#IFD#);
663 impl_tiff_value_for_contiguous_sequencerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl_tiff_value_for_contiguous_sequence!!(Ifd8rust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Ifd8#; 8; Typerust-analyzer cargo tiff 0.11.3 tags/Type#::IFD8rust-analyzer cargo tiff 0.11.3 tags/Type#IFD8#);
664 impl_tiff_value_for_contiguous_sequencerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl_tiff_value_for_contiguous_sequence!!(Rationalrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Rational#; 8; Typerust-analyzer cargo tiff 0.11.3 tags/Type#::RATIONALrust-analyzer cargo tiff 0.11.3 tags/Type#RATIONAL#);
665 impl_tiff_value_for_contiguous_sequencerust-analyzer cargo tiff 0.11.3 encoder/tiff_value/impl_tiff_value_for_contiguous_sequence!!(SRationalrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/SRational#; 8; Typerust-analyzer cargo tiff 0.11.3 tags/Type#::SRATIONALrust-analyzer cargo tiff 0.11.3 tags/Type#SRATIONAL#);
666
667 /// Type to represent tiff values of type `IFD`
668 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)]
669 pub struct Ifdrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Ifd#(pub u32);
670
671 /// Type to represent tiff values of type `IFD8`
672 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)]
673 pub struct Ifd8rust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Ifd8#(pub u64);
674
675 /// Type to represent tiff values of type `RATIONAL`
676 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)]
677 pub struct Rationalrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Rational# {
678 pub nrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Rational#n.: u32,
679 pub drust-analyzer cargo tiff 0.11.3 encoder/tiff_value/Rational#d.: u32,
680 }
681
682 /// Type to represent tiff values of type `SRATIONAL`
683 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)]
684 pub struct SRationalrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/SRational# {
685 pub nrust-analyzer cargo tiff 0.11.3 encoder/tiff_value/SRational#n.: i32,
686 pub drust-analyzer cargo tiff 0.11.3 encoder/tiff_value/SRational#d.: i32,
687 }