| 1 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::allocrust-analyzer cargo std https://github.com/rust-lang/rust/library/std alloc/::{Layoutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/Layout#, LayoutErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/LayoutError#}; |
| 2 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#; |
| 3 |
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/::{selfrust-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#, Seekrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Seek#}; |
| 4 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::numrust-analyzer cargo std https://github.com/rust-lang/rust/library/std num/::NonZeroUsizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroUsize#; |
| 5 |
|
| 6 |
use craterust-analyzer cargo tiff 0.11.3 crate/::tagsrust-analyzer cargo tiff 0.11.3 tags/::{ |
| 7 |
CompressionMethodrust-analyzer cargo tiff 0.11.3 tags/CompressionMethod#, IfdPointerrust-analyzer cargo tiff 0.11.3 tags/IfdPointer#, PhotometricInterpretationrust-analyzer cargo tiff 0.11.3 tags/PhotometricInterpretation#, PlanarConfigurationrust-analyzer cargo tiff 0.11.3 tags/PlanarConfiguration#, Predictorrust-analyzer cargo tiff 0.11.3 tags/Predictor#, |
| 8 |
SampleFormatrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#, Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#, Typerust-analyzer cargo tiff 0.11.3 tags/Type#, ValueBufferrust-analyzer cargo tiff 0.11.3 tags/ValueBuffer#, |
| 9 |
}; |
| 10 |
use craterust-analyzer cargo tiff 0.11.3 crate/::{ |
| 11 |
bytecastrust-analyzer cargo tiff 0.11.3 bytecast/, ColorTyperust-analyzer cargo tiff 0.11.3 ColorType#, Directoryrust-analyzer cargo tiff 0.11.3 directory/Directory#, 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#, TiffUnsupportedErrorrust-analyzer cargo tiff 0.11.3 error/TiffUnsupportedError#, |
| 12 |
UsageErrorrust-analyzer cargo tiff 0.11.3 error/UsageError#, |
| 13 |
}; |
| 14 |
use halfrust-analyzer cargo half 2.6.0 crate/::f16rust-analyzer cargo half 2.6.0 binary16/f16#; |
| 15 |
|
| 16 |
use selfrust-analyzer cargo tiff 0.11.3 decoder/::imagerust-analyzer cargo tiff 0.11.3 decoder/image/::Imagerust-analyzer cargo tiff 0.11.3 decoder/image/Image#; |
| 17 |
use selfrust-analyzer cargo tiff 0.11.3 decoder/::streamrust-analyzer cargo tiff 0.11.3 decoder/stream/::{ByteOrderrust-analyzer cargo tiff 0.11.3 tags/ByteOrder#, EndianReaderrust-analyzer cargo tiff 0.11.3 decoder/stream/EndianReader#}; |
| 18 |
|
| 19 |
mod cyclesrust-analyzer cargo tiff 0.11.3 decoder/cycles/; |
| 20 |
pub mod ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/; |
| 21 |
mod imagerust-analyzer cargo tiff 0.11.3 decoder/image/; |
| 22 |
mod streamrust-analyzer cargo tiff 0.11.3 decoder/stream/; |
| 23 |
mod tag_readerrust-analyzer cargo tiff 0.11.3 decoder/tag_reader/; |
| 24 |
|
| 25 |
/// An index referring to a (rectangular) region of an image. |
| 26 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:)] |
| 27 |
pub struct TiffCodingUnitrust-analyzer cargo tiff 0.11.3 decoder/TiffCodingUnit#(pub u32); |
| 28 |
|
| 29 |
/// Result of a decoding process |
| 30 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 31 |
pub enum DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult# { |
| 32 |
/// A vector of unsigned bytes |
| 33 |
U8rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#U8#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>), |
| 34 |
/// A vector of unsigned words |
| 35 |
U16rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#U16#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u16>), |
| 36 |
/// A vector of 32 bit unsigned ints |
| 37 |
U32rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#U32#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u32>), |
| 38 |
/// A vector of 64 bit unsigned ints |
| 39 |
U64rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#U64#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u64>), |
| 40 |
/// A vector of 16 bit IEEE floats (held in u16) |
| 41 |
F16rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#F16#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<f16rust-analyzer cargo half 2.6.0 binary16/f16#>), |
| 42 |
/// A vector of 32 bit IEEE floats |
| 43 |
F32rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#F32#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<f32>), |
| 44 |
/// A vector of 64 bit IEEE floats |
| 45 |
F64rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#F64#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<f64>), |
| 46 |
/// A vector of 8 bit signed ints |
| 47 |
I8rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#I8#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<i8>), |
| 48 |
/// A vector of 16 bit signed ints |
| 49 |
I16rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#I16#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<i16>), |
| 50 |
/// A vector of 32 bit signed ints |
| 51 |
I32rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#I32#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<i32>), |
| 52 |
/// A vector of 64 bit signed ints |
| 53 |
I64rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#I64#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<i64>), |
| 54 |
} |
| 55 |
|
| 56 |
impl DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult# { |
| 57 |
/// Reallocate the buffer to decode all planes of the indicated layout. |
| 58 |
pub fn resize_torust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]resize_to().( |
| 59 |
&mut self, |
| 60 |
buffer: &BufferLayoutPreferencerust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#, |
| 61 |
limits: &Limitsrust-analyzer cargo tiff 0.11.3 decoder/Limits#, |
| 62 |
) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), TiffErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#> { |
| 63 |
let sample_type = buffer.sample_typerust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#sample_type..ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(TiffErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#::UnsupportedErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#UnsupportedError#( |
| 64 |
TiffUnsupportedErrorrust-analyzer cargo tiff 0.11.3 error/TiffUnsupportedError#::UnknownInterpretationrust-analyzer cargo tiff 0.11.3 error/TiffUnsupportedError#UnknownInterpretation#, |
| 65 |
))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 66 |
|
| 67 |
let extent = sample_type.extent_for_bytesrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingSampleType]extent_for_bytes().(buffer.complete_lenrust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#complete_len.); |
| 68 |
self.resize_to_extentrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]resize_to_extent().(extent, limits) |
| 69 |
} |
| 70 |
|
| 71 |
fn resize_to_extentrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]resize_to_extent().( |
| 72 |
&mut self, |
| 73 |
extent: DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#, |
| 74 |
limits: &Limitsrust-analyzer cargo tiff 0.11.3 decoder/Limits#, |
| 75 |
) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), TiffErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#> { |
| 76 |
// FIXME: we *can* reuse the allocation sometimes. |
| 77 |
*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().self = extent.to_result_bufferrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingExtent]to_result_buffer().(limits)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 78 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 79 |
} |
| 80 |
|
| 81 |
fn newrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new().<T: Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# + Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy#>( |
| 82 |
size: usize, |
| 83 |
limits: &Limitsrust-analyzer cargo tiff 0.11.3 decoder/Limits#, |
| 84 |
from_fn: fn(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<T>) -> Selfrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult], |
| 85 |
) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#> { |
| 86 |
if size rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().limits.decoding_buffer_sizerust-analyzer cargo tiff 0.11.3 decoder/Limits#decoding_buffer_size. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<T>() { |
| 87 |
Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(TiffErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#::LimitsExceededrust-analyzer cargo tiff 0.11.3 error/TiffError#LimitsExceeded#) |
| 88 |
} else { |
| 89 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(from_fn(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![T::defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#default().(); size])) |
| 90 |
} |
| 91 |
} |
| 92 |
|
| 93 |
fn new_u8rust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new_u8().(size: usize, limits: &Limitsrust-analyzer cargo tiff 0.11.3 decoder/Limits#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#> { |
| 94 |
Selfrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]::newrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new().(size, limits, DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::U8rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#U8#) |
| 95 |
} |
| 96 |
|
| 97 |
fn new_u16rust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new_u16().(size: usize, limits: &Limitsrust-analyzer cargo tiff 0.11.3 decoder/Limits#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#> { |
| 98 |
Selfrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]::newrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new().(size, limits, DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::U16rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#U16#) |
| 99 |
} |
| 100 |
|
| 101 |
fn new_u32rust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new_u32().(size: usize, limits: &Limitsrust-analyzer cargo tiff 0.11.3 decoder/Limits#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#> { |
| 102 |
Selfrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]::newrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new().(size, limits, DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::U32rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#U32#) |
| 103 |
} |
| 104 |
|
| 105 |
fn new_u64rust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new_u64().(size: usize, limits: &Limitsrust-analyzer cargo tiff 0.11.3 decoder/Limits#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#> { |
| 106 |
Selfrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]::newrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new().(size, limits, DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::U64rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#U64#) |
| 107 |
} |
| 108 |
|
| 109 |
fn new_f32rust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new_f32().(size: usize, limits: &Limitsrust-analyzer cargo tiff 0.11.3 decoder/Limits#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#> { |
| 110 |
Selfrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]::newrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new().(size, limits, DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::F32rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#F32#) |
| 111 |
} |
| 112 |
|
| 113 |
fn new_f64rust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new_f64().(size: usize, limits: &Limitsrust-analyzer cargo tiff 0.11.3 decoder/Limits#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#> { |
| 114 |
Selfrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]::newrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new().(size, limits, DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::F64rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#F64#) |
| 115 |
} |
| 116 |
|
| 117 |
fn new_f16rust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new_f16().(size: usize, limits: &Limitsrust-analyzer cargo tiff 0.11.3 decoder/Limits#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#> { |
| 118 |
Selfrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]::newrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new().(size, limits, DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::F16rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#F16#) |
| 119 |
} |
| 120 |
|
| 121 |
fn new_i8rust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new_i8().(size: usize, limits: &Limitsrust-analyzer cargo tiff 0.11.3 decoder/Limits#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#> { |
| 122 |
Selfrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]::newrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new().(size, limits, DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::I8rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#I8#) |
| 123 |
} |
| 124 |
|
| 125 |
fn new_i16rust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new_i16().(size: usize, limits: &Limitsrust-analyzer cargo tiff 0.11.3 decoder/Limits#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#> { |
| 126 |
Selfrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]::newrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new().(size, limits, DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::I16rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#I16#) |
| 127 |
} |
| 128 |
|
| 129 |
fn new_i32rust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new_i32().(size: usize, limits: &Limitsrust-analyzer cargo tiff 0.11.3 decoder/Limits#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#> { |
| 130 |
Selfrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]::newrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new().(size, limits, DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::I32rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#I32#) |
| 131 |
} |
| 132 |
|
| 133 |
fn new_i64rust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new_i64().(size: usize, limits: &Limitsrust-analyzer cargo tiff 0.11.3 decoder/Limits#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#> { |
| 134 |
Selfrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]::newrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new().(size, limits, DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::I64rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#I64#) |
| 135 |
} |
| 136 |
|
| 137 |
/// Get a view of this buffer starting from the nth _sample_ of the current type. |
| 138 |
pub fn as_bufferrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]as_buffer().(&mut self, start: usize) -> DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#<'_> { |
| 139 |
match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().self { |
| 140 |
DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::U8rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#U8#(ref mut buf) => DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::U8rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#U8#(&mut buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().), |
| 141 |
DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::U16rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#U16#(ref mut buf) => DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::U16rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#U16#(&mut buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().), |
| 142 |
DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::U32rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#U32#(ref mut buf) => DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::U32rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#U32#(&mut buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().), |
| 143 |
DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::U64rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#U64#(ref mut buf) => DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::U64rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#U64#(&mut buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().), |
| 144 |
DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::F16rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#F16#(ref mut buf) => DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::F16rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#F16#(&mut buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().), |
| 145 |
DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::F32rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#F32#(ref mut buf) => DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::F32rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#F32#(&mut buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().), |
| 146 |
DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::F64rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#F64#(ref mut buf) => DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::F64rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#F64#(&mut buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().), |
| 147 |
DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::I8rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#I8#(ref mut buf) => DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::I8rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#I8#(&mut buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().), |
| 148 |
DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::I16rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#I16#(ref mut buf) => DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::I16rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#I16#(&mut buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().), |
| 149 |
DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::I32rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#I32#(ref mut buf) => DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::I32rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#I32#(&mut buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().), |
| 150 |
DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::I64rust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#I64#(ref mut buf) => DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::I64rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#I64#(&mut buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().), |
| 151 |
} |
| 152 |
} |
| 153 |
} |
| 154 |
|
| 155 |
// A buffer for image decoding |
| 156 |
pub enum DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#<'a> { |
| 157 |
/// A slice of unsigned bytes |
| 158 |
U8rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#U8#(&'a mut [u8]), |
| 159 |
/// A slice of unsigned words |
| 160 |
U16rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#U16#(&'a mut [u16]), |
| 161 |
/// A slice of 32 bit unsigned ints |
| 162 |
U32rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#U32#(&'a mut [u32]), |
| 163 |
/// A slice of 64 bit unsigned ints |
| 164 |
U64rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#U64#(&'a mut [u64]), |
| 165 |
/// A slice of 16 bit IEEE floats |
| 166 |
F16rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#F16#(&'a mut [f16rust-analyzer cargo half 2.6.0 binary16/f16#]), |
| 167 |
/// A slice of 32 bit IEEE floats |
| 168 |
F32rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#F32#(&'a mut [f32]), |
| 169 |
/// A slice of 64 bit IEEE floats |
| 170 |
F64rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#F64#(&'a mut [f64]), |
| 171 |
/// A slice of 8 bits signed ints |
| 172 |
I8rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#I8#(&'a mut [i8]), |
| 173 |
/// A slice of 16 bits signed ints |
| 174 |
I16rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#I16#(&'a mut [i16]), |
| 175 |
/// A slice of 32 bits signed ints |
| 176 |
I32rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#I32#(&'a mut [i32]), |
| 177 |
/// A slice of 64 bits signed ints |
| 178 |
I64rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#I64#(&'a mut [i64]), |
| 179 |
} |
| 180 |
|
| 181 |
impl<'a> DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#<'a> { |
| 182 |
pub fn as_bytesrust-analyzer cargo tiff 0.11.3 decoder/impl#[`DecodingBuffer<'a>`]as_bytes().(&self) -> &[u8] { |
| 183 |
match self { |
| 184 |
DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::U8rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#U8#(buf) => buf, |
| 185 |
DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::I8rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#I8#(buf) => bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::i8_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/i8_as_ne_bytes().(buf), |
| 186 |
DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::U16rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#U16#(buf) => bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::u16_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/u16_as_ne_bytes().(buf), |
| 187 |
DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::I16rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#I16#(buf) => bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::i16_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/i16_as_ne_bytes().(buf), |
| 188 |
DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::U32rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#U32#(buf) => bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::u32_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/u32_as_ne_bytes().(buf), |
| 189 |
DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::I32rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#I32#(buf) => bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::i32_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/i32_as_ne_bytes().(buf), |
| 190 |
DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::U64rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#U64#(buf) => bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::u64_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/u64_as_ne_bytes().(buf), |
| 191 |
DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::I64rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#I64#(buf) => bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::i64_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/i64_as_ne_bytes().(buf), |
| 192 |
DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::F16rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#F16#(buf) => bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::f16_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/f16_as_ne_bytes().(buf), |
| 193 |
DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::F32rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#F32#(buf) => bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::f32_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/f32_as_ne_bytes().(buf), |
| 194 |
DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::F64rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#F64#(buf) => bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::f64_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/f64_as_ne_bytes().(buf), |
| 195 |
} |
| 196 |
} |
| 197 |
|
| 198 |
pub fn as_bytes_mutrust-analyzer cargo tiff 0.11.3 decoder/impl#[`DecodingBuffer<'a>`]as_bytes_mut().(&mut self) -> &mut [u8] { |
| 199 |
match self { |
| 200 |
DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::U8rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#U8#(buf) => buf, |
| 201 |
DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::I8rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#I8#(buf) => bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::i8_as_ne_mut_bytesrust-analyzer cargo tiff 0.11.3 bytecast/i8_as_ne_mut_bytes().(buf), |
| 202 |
DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::U16rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#U16#(buf) => bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::u16_as_ne_mut_bytesrust-analyzer cargo tiff 0.11.3 bytecast/u16_as_ne_mut_bytes().(buf), |
| 203 |
DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::I16rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#I16#(buf) => bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::i16_as_ne_mut_bytesrust-analyzer cargo tiff 0.11.3 bytecast/i16_as_ne_mut_bytes().(buf), |
| 204 |
DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::U32rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#U32#(buf) => bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::u32_as_ne_mut_bytesrust-analyzer cargo tiff 0.11.3 bytecast/u32_as_ne_mut_bytes().(buf), |
| 205 |
DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::I32rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#I32#(buf) => bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::i32_as_ne_mut_bytesrust-analyzer cargo tiff 0.11.3 bytecast/i32_as_ne_mut_bytes().(buf), |
| 206 |
DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::U64rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#U64#(buf) => bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::u64_as_ne_mut_bytesrust-analyzer cargo tiff 0.11.3 bytecast/u64_as_ne_mut_bytes().(buf), |
| 207 |
DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::I64rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#I64#(buf) => bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::i64_as_ne_mut_bytesrust-analyzer cargo tiff 0.11.3 bytecast/i64_as_ne_mut_bytes().(buf), |
| 208 |
DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::F16rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#F16#(buf) => bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::f16_as_ne_mut_bytesrust-analyzer cargo tiff 0.11.3 bytecast/f16_as_ne_mut_bytes().(buf), |
| 209 |
DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::F32rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#F32#(buf) => bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::f32_as_ne_mut_bytesrust-analyzer cargo tiff 0.11.3 bytecast/f32_as_ne_mut_bytes().(buf), |
| 210 |
DecodingBufferrust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#::F64rust-analyzer cargo tiff 0.11.3 decoder/DecodingBuffer#F64#(buf) => bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::f64_as_ne_mut_bytesrust-analyzer cargo tiff 0.11.3 bytecast/f64_as_ne_mut_bytes().(buf), |
| 211 |
} |
| 212 |
} |
| 213 |
|
| 214 |
pub fn byte_lenrust-analyzer cargo tiff 0.11.3 decoder/impl#[`DecodingBuffer<'a>`]byte_len().(&self) -> usize { |
| 215 |
self.as_bytesrust-analyzer cargo tiff 0.11.3 decoder/impl#[`DecodingBuffer<'a>`]as_bytes().().lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() |
| 216 |
} |
| 217 |
} |
| 218 |
|
| 219 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:)] |
| 220 |
pub enum DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType# { |
| 221 |
U8rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#U8#, |
| 222 |
U16rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#U16#, |
| 223 |
U32rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#U32#, |
| 224 |
U64rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#U64#, |
| 225 |
F16rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#F16#, |
| 226 |
F32rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#F32#, |
| 227 |
F64rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#F64#, |
| 228 |
I8rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#I8#, |
| 229 |
I16rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#I16#, |
| 230 |
I32rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#I32#, |
| 231 |
I64rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#I64#, |
| 232 |
} |
| 233 |
|
| 234 |
impl DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType# { |
| 235 |
fn extent_for_bytesrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingSampleType]extent_for_bytes().(self, bytes: usize) -> DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent# { |
| 236 |
match self { |
| 237 |
DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::U8rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#U8# => DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::U8rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#U8#(bytes), |
| 238 |
DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::U16rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#U16# => DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::U16rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#U16#(bytes.div_ceilrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]div_ceil().(2)), |
| 239 |
DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::U32rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#U32# => DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::U32rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#U32#(bytes.div_ceilrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]div_ceil().(4)), |
| 240 |
DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::U64rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#U64# => DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::U64rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#U64#(bytes.div_ceilrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]div_ceil().(8)), |
| 241 |
DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::I8rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#I8# => DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::I8rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#I8#(bytes), |
| 242 |
DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::I16rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#I16# => DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::I16rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#I16#(bytes.div_ceilrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]div_ceil().(2)), |
| 243 |
DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::I32rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#I32# => DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::I32rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#I32#(bytes.div_ceilrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]div_ceil().(4)), |
| 244 |
DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::I64rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#I64# => DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::I64rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#I64#(bytes.div_ceilrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]div_ceil().(8)), |
| 245 |
DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::F16rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#F16# => DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::F16rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#F16#(bytes.div_ceilrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]div_ceil().(2)), |
| 246 |
DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::F32rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#F32# => DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::F32rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#F32#(bytes.div_ceilrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]div_ceil().(4)), |
| 247 |
DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::F64rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#F64# => DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::F64rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#F64#(bytes.div_ceilrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]div_ceil().(8)), |
| 248 |
} |
| 249 |
} |
| 250 |
} |
| 251 |
|
| 252 |
/// Information on the byte buffer that should be supplied to the decoder. |
| 253 |
/// |
| 254 |
/// This is relevant for [`Decoder::read_image_bytes`] and [`Decoder::read_chunk_bytes`] where the |
| 255 |
/// caller provided buffer must fit the expectations of the decoder to be filled with data from the |
| 256 |
/// current image. |
| 257 |
#[non_exhaustive] |
| 258 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 259 |
pub struct BufferLayoutPreferencerust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference# { |
| 260 |
/// Minimum byte size of the buffer to read image data. |
| 261 |
pub lenrust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#len.: usize, |
| 262 |
/// The interpretation of each sample in the image. |
| 263 |
/// |
| 264 |
/// We only support a uniform sample layout. Detailed information for mixed colors may be added |
| 265 |
/// in the future and will become available by explicit query. The same goes for the bit-depth |
| 266 |
/// of samples that must also be uniform. |
| 267 |
pub sample_formatrust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#sample_format.: SampleFormatrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#, |
| 268 |
/// The type representation for each sample. Only available for depths and formats which the |
| 269 |
/// library can describe. |
| 270 |
pub sample_typerust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#sample_type.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#>, |
| 271 |
/// Minimum number of bytes to represent a row of image data of the requested content. |
| 272 |
pub row_striderust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#row_stride.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<NonZeroUsizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroUsize#>, |
| 273 |
/// Number of planes in the image. |
| 274 |
pub planesrust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#planes.: usize, |
| 275 |
/// Number of bytes used to represent one plane. |
| 276 |
pub plane_striderust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#plane_stride.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<NonZeroUsizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroUsize#>, |
| 277 |
/// Number of bytes of data when reading all planes. |
| 278 |
pub complete_lenrust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#complete_len.: usize, |
| 279 |
} |
| 280 |
|
| 281 |
impl BufferLayoutPreferencerust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference# { |
| 282 |
fn from_planesrust-analyzer cargo tiff 0.11.3 decoder/impl#[BufferLayoutPreference]from_planes().(layout: &imagerust-analyzer cargo tiff 0.11.3 decoder/image/::PlaneLayoutrust-analyzer cargo tiff 0.11.3 decoder/image/PlaneLayout#) -> Selfrust-analyzer cargo tiff 0.11.3 decoder/impl#[BufferLayoutPreference] { |
| 283 |
BufferLayoutPreferencerust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference# { |
| 284 |
lenrust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#len.: layout.readoutrust-analyzer cargo tiff 0.11.3 decoder/image/PlaneLayout#readout..plane_striderust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#plane_stride., |
| 285 |
row_striderust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#row_stride.: corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::numrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/::NonZeroUsizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroUsize#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/impl#[`NonZero<T>`]new().(layout.readoutrust-analyzer cargo tiff 0.11.3 decoder/image/PlaneLayout#readout..row_striderust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#row_stride.), |
| 286 |
planesrust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#planes.: layout.plane_offsetsrust-analyzer cargo tiff 0.11.3 decoder/image/PlaneLayout#plane_offsets..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), |
| 287 |
plane_striderust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#plane_stride.: corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::numrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/::NonZeroUsizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroUsize#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/impl#[`NonZero<T>`]new().(layout.readoutrust-analyzer cargo tiff 0.11.3 decoder/image/PlaneLayout#readout..plane_striderust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#plane_stride.), |
| 288 |
complete_lenrust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#complete_len.: layout.total_bytesrust-analyzer cargo tiff 0.11.3 decoder/image/PlaneLayout#total_bytes., |
| 289 |
sample_formatrust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#sample_format.: layout.readoutrust-analyzer cargo tiff 0.11.3 decoder/image/PlaneLayout#readout..sample_formatrust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#sample_format., |
| 290 |
sample_typerust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#sample_type.: Selfrust-analyzer cargo tiff 0.11.3 decoder/impl#[BufferLayoutPreference]::sample_typerust-analyzer cargo tiff 0.11.3 decoder/impl#[BufferLayoutPreference]sample_type().(layout.readoutrust-analyzer cargo tiff 0.11.3 decoder/image/PlaneLayout#readout..sample_formatrust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#sample_format., layout.readoutrust-analyzer cargo tiff 0.11.3 decoder/image/PlaneLayout#readout..colorrust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#color.), |
| 291 |
} |
| 292 |
} |
| 293 |
|
| 294 |
fn sample_typerust-analyzer cargo tiff 0.11.3 decoder/impl#[BufferLayoutPreference]sample_type().(sample_format: SampleFormatrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#, color: ColorTyperust-analyzer cargo tiff 0.11.3 ColorType#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#> { |
| 295 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(match sample_format { |
| 296 |
SampleFormatrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#::Uintrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#Uint# => match color.bit_depthrust-analyzer cargo tiff 0.11.3 impl#[ColorType]bit_depth().() { |
| 297 |
n if n rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le().8 => DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::U8rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#U8#, |
| 298 |
n if n rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le().16 => DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::U16rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#U16#, |
| 299 |
n if n rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le().32 => DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::U32rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#U32#, |
| 300 |
n if n rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le().64 => DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::U64rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#U64#, |
| 301 |
_ => return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 302 |
}, |
| 303 |
SampleFormatrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#::IEEEFPrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#IEEEFP# => match color.bit_depthrust-analyzer cargo tiff 0.11.3 impl#[ColorType]bit_depth().() { |
| 304 |
16 => DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::F16rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#F16#, |
| 305 |
32 => DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::F32rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#F32#, |
| 306 |
64 => DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::F64rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#F64#, |
| 307 |
_ => return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 308 |
}, |
| 309 |
SampleFormatrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#::Intrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#Int# => match color.bit_depthrust-analyzer cargo tiff 0.11.3 impl#[ColorType]bit_depth().() { |
| 310 |
n if n rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le().8 => DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::I8rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#I8#, |
| 311 |
n if n rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le().16 => DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::I16rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#I16#, |
| 312 |
n if n rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le().32 => DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::I32rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#I32#, |
| 313 |
n if n rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le().64 => DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::I64rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#I64#, |
| 314 |
_ => return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 315 |
}, |
| 316 |
_other => { |
| 317 |
return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 318 |
} |
| 319 |
}) |
| 320 |
} |
| 321 |
} |
| 322 |
|
| 323 |
impl imagerust-analyzer cargo tiff 0.11.3 decoder/image/::ReadoutLayoutrust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout# { |
| 324 |
// FIXME: when planes are not homogenous (i.e. subsampled or differing depths) then the |
| 325 |
// `readout_for_size` or `to_plane_layout` needs a parameter to determine the planes being |
| 326 |
// read instead of assuming a constant repeated size for them. |
| 327 |
fn result_extent_for_planesrust-analyzer cargo tiff 0.11.3 decoder/impl#[`image::ReadoutLayout`]result_extent_for_planes().( |
| 328 |
self: &imagerust-analyzer cargo tiff 0.11.3 decoder/image/::ReadoutLayoutrust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#, |
| 329 |
planes: corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Rangerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#<u16>, |
| 330 |
) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#> { |
| 331 |
let buffer = self.to_plane_layoutrust-analyzer cargo tiff 0.11.3 decoder/image/impl#[ReadoutLayout]to_plane_layout().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 332 |
|
| 333 |
// The layout is for all planes. So restrict ourselves to the planes that were requested. |
| 334 |
let offset = match buffer.plane_offsetsrust-analyzer cargo tiff 0.11.3 decoder/image/PlaneLayout#plane_offsets..getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(usize::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[usize][`From<u16>`]from().(planes.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#start.)) { |
| 335 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(n) => *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().n, |
| 336 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => { |
| 337 |
return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(TiffErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#::UsageErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#UsageError#(UsageErrorrust-analyzer cargo tiff 0.11.3 error/UsageError#::InvalidPlaneIndexrust-analyzer cargo tiff 0.11.3 error/UsageError#InvalidPlaneIndex#( |
| 338 |
planes.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#start., |
| 339 |
))) |
| 340 |
} |
| 341 |
}; |
| 342 |
|
| 343 |
let end = match buffer.plane_offsetsrust-analyzer cargo tiff 0.11.3 decoder/image/PlaneLayout#plane_offsets..getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(usize::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[usize][`From<u16>`]from().(planes.endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#end.)) { |
| 344 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(n) => *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().n, |
| 345 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => buffer.total_bytesrust-analyzer cargo tiff 0.11.3 decoder/image/PlaneLayout#total_bytes., |
| 346 |
}; |
| 347 |
|
| 348 |
let buffer_bytes = end rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().offset; |
| 349 |
let bits_per_sample = self.colorrust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#color..bit_depthrust-analyzer cargo tiff 0.11.3 impl#[ColorType]bit_depth().(); |
| 350 |
|
| 351 |
let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(sample_type) = BufferLayoutPreferencerust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#::sample_typerust-analyzer cargo tiff 0.11.3 decoder/impl#[BufferLayoutPreference]sample_type().(self.sample_formatrust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#sample_format., self.colorrust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#color.) |
| 352 |
else { |
| 353 |
if matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!( |
| 354 |
self.sample_formatrust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#sample_format., |
| 355 |
SampleFormatrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#::Uintrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#Uint# | SampleFormatrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#::Intrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#Int# | SampleFormatrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#::IEEEFPrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#IEEEFP# |
| 356 |
) { |
| 357 |
return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(TiffErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#::UnsupportedErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#UnsupportedError#( |
| 358 |
TiffUnsupportedErrorrust-analyzer cargo tiff 0.11.3 error/TiffUnsupportedError#::UnsupportedSampleDepthrust-analyzer cargo tiff 0.11.3 error/TiffUnsupportedError#UnsupportedSampleDepth#(bits_per_sample), |
| 359 |
)); |
| 360 |
} else { |
| 361 |
return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(TiffErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#::UnsupportedErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#UnsupportedError#( |
| 362 |
TiffUnsupportedErrorrust-analyzer cargo tiff 0.11.3 error/TiffUnsupportedError#::UnsupportedSampleFormatrust-analyzer cargo tiff 0.11.3 error/TiffUnsupportedError#UnsupportedSampleFormat#(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![self.sample_formatrust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#sample_format.]), |
| 363 |
)); |
| 364 |
} |
| 365 |
}; |
| 366 |
|
| 367 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(sample_type.extent_for_bytesrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingSampleType]extent_for_bytes().(buffer_bytes)) |
| 368 |
} |
| 369 |
|
| 370 |
#[inline(always)] |
| 371 |
fn assert_min_layoutrust-analyzer cargo tiff 0.11.3 decoder/impl#[`image::ReadoutLayout`]assert_min_layout().<T>(&self, buffer: &[T]) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> { |
| 372 |
if corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_of_valrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of_val().(buffer) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().self.plane_striderust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#plane_stride. { |
| 373 |
Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(TiffErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#::UsageErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#UsageError#( |
| 374 |
UsageErrorrust-analyzer cargo tiff 0.11.3 error/UsageError#::InsufficientOutputBufferSizerust-analyzer cargo tiff 0.11.3 error/UsageError#InsufficientOutputBufferSize# { |
| 375 |
neededrust-analyzer cargo tiff 0.11.3 error/UsageError#InsufficientOutputBufferSize#needed.: self.plane_striderust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#plane_stride., |
| 376 |
providedrust-analyzer cargo tiff 0.11.3 error/UsageError#InsufficientOutputBufferSize#provided.: buffer.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().(), |
| 377 |
}, |
| 378 |
)) |
| 379 |
} else { |
| 380 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 381 |
} |
| 382 |
} |
| 383 |
} |
| 384 |
|
| 385 |
/// The count and matching discriminant for a `DecodingBuffer`. |
| 386 |
#[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:)] |
| 387 |
enum DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent# { |
| 388 |
U8rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#U8#(usize), |
| 389 |
U16rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#U16#(usize), |
| 390 |
U32rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#U32#(usize), |
| 391 |
U64rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#U64#(usize), |
| 392 |
F16rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#F16#(usize), |
| 393 |
F32rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#F32#(usize), |
| 394 |
F64rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#F64#(usize), |
| 395 |
I8rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#I8#(usize), |
| 396 |
I16rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#I16#(usize), |
| 397 |
I32rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#I32#(usize), |
| 398 |
I64rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#I64#(usize), |
| 399 |
} |
| 400 |
|
| 401 |
impl DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent# { |
| 402 |
fn to_result_bufferrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingExtent]to_result_buffer().(&self, limits: &Limitsrust-analyzer cargo tiff 0.11.3 decoder/Limits#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#> { |
| 403 |
match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 404 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::U8rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#U8#(count) => DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::new_u8rust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new_u8().(count, limits), |
| 405 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::U16rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#U16#(count) => DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::new_u16rust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new_u16().(count, limits), |
| 406 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::U32rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#U32#(count) => DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::new_u32rust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new_u32().(count, limits), |
| 407 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::U64rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#U64#(count) => DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::new_u64rust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new_u64().(count, limits), |
| 408 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::F16rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#F16#(count) => DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::new_f16rust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new_f16().(count, limits), |
| 409 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::F32rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#F32#(count) => DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::new_f32rust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new_f32().(count, limits), |
| 410 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::F64rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#F64#(count) => DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::new_f64rust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new_f64().(count, limits), |
| 411 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::I8rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#I8#(count) => DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::new_i8rust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new_i8().(count, limits), |
| 412 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::I16rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#I16#(count) => DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::new_i16rust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new_i16().(count, limits), |
| 413 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::I32rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#I32#(count) => DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::new_i32rust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new_i32().(count, limits), |
| 414 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::I64rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#I64#(count) => DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#::new_i64rust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]new_i64().(count, limits), |
| 415 |
} |
| 416 |
} |
| 417 |
|
| 418 |
fn preferred_layoutrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingExtent]preferred_layout().(self) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Layoutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/Layout#> { |
| 419 |
fn overflowrust-analyzer cargo tiff 0.11.3 decoder/overflow().(_: LayoutErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/LayoutError#) -> TiffErrorrust-analyzer cargo tiff 0.11.3 error/TiffError# { |
| 420 |
TiffErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#::LimitsExceededrust-analyzer cargo tiff 0.11.3 error/TiffError#LimitsExceeded# |
| 421 |
} |
| 422 |
|
| 423 |
match self { |
| 424 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::U8rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#U8#(count) => Layoutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/Layout#::arrayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/impl#[Layout]array().::<u8>(count), |
| 425 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::U16rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#U16#(count) => Layoutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/Layout#::arrayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/impl#[Layout]array().::<u16>(count), |
| 426 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::U32rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#U32#(count) => Layoutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/Layout#::arrayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/impl#[Layout]array().::<u32>(count), |
| 427 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::U64rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#U64#(count) => Layoutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/Layout#::arrayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/impl#[Layout]array().::<u64>(count), |
| 428 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::F16rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#F16#(count) => Layoutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/Layout#::arrayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/impl#[Layout]array().::<f16rust-analyzer cargo half 2.6.0 binary16/f16#>(count), |
| 429 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::F32rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#F32#(count) => Layoutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/Layout#::arrayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/impl#[Layout]array().::<f32>(count), |
| 430 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::F64rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#F64#(count) => Layoutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/Layout#::arrayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/impl#[Layout]array().::<f64>(count), |
| 431 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::I8rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#I8#(count) => Layoutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/Layout#::arrayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/impl#[Layout]array().::<i8>(count), |
| 432 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::I16rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#I16#(count) => Layoutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/Layout#::arrayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/impl#[Layout]array().::<i16>(count), |
| 433 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::I32rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#I32#(count) => Layoutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/Layout#::arrayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/impl#[Layout]array().::<i32>(count), |
| 434 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::I64rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#I64#(count) => Layoutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/Layout#::arrayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/impl#[Layout]array().::<i64>(count), |
| 435 |
} |
| 436 |
.map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(overflowrust-analyzer cargo tiff 0.11.3 decoder/overflow().) |
| 437 |
} |
| 438 |
|
| 439 |
fn sample_typerust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingExtent]sample_type().(&self) -> DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType# { |
| 440 |
match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 441 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::U8rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#U8#(_) => DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::U8rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#U8#, |
| 442 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::U16rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#U16#(_) => DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::U16rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#U16#, |
| 443 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::U32rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#U32#(_) => DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::U32rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#U32#, |
| 444 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::U64rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#U64#(_) => DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::U64rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#U64#, |
| 445 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::F16rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#F16#(_) => DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::F16rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#F16#, |
| 446 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::F32rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#F32#(_) => DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::F32rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#F32#, |
| 447 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::F64rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#F64#(_) => DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::F64rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#F64#, |
| 448 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::I8rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#I8#(_) => DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::I8rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#I8#, |
| 449 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::I16rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#I16#(_) => DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::I16rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#I16#, |
| 450 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::I32rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#I32#(_) => DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::I32rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#I32#, |
| 451 |
DecodingExtentrust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#::I64rust-analyzer cargo tiff 0.11.3 decoder/DecodingExtent#I64#(_) => DecodingSampleTyperust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#::I64rust-analyzer cargo tiff 0.11.3 decoder/DecodingSampleType#I64#, |
| 452 |
} |
| 453 |
} |
| 454 |
} |
| 455 |
|
| 456 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 457 |
/// Chunk type of the internal representation |
| 458 |
pub enum ChunkTyperust-analyzer cargo tiff 0.11.3 decoder/ChunkType# { |
| 459 |
Striprust-analyzer cargo tiff 0.11.3 decoder/ChunkType#Strip#, |
| 460 |
Tilerust-analyzer cargo tiff 0.11.3 decoder/ChunkType#Tile#, |
| 461 |
} |
| 462 |
|
| 463 |
/// Decoding limits |
| 464 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 465 |
#[non_exhaustive] |
| 466 |
pub struct Limitsrust-analyzer cargo tiff 0.11.3 decoder/Limits# { |
| 467 |
/// The maximum size of any `DecodingResult` in bytes, the default is |
| 468 |
/// 256MiB. If the entire image is decoded at once, then this will |
| 469 |
/// be the maximum size of the image. If it is decoded one strip at a |
| 470 |
/// time, this will be the maximum size of a strip. |
| 471 |
pub decoding_buffer_sizerust-analyzer cargo tiff 0.11.3 decoder/Limits#decoding_buffer_size.: usize, |
| 472 |
/// The maximum size of any ifd value in bytes, the default is |
| 473 |
/// 1MiB. |
| 474 |
pub ifd_value_sizerust-analyzer cargo tiff 0.11.3 decoder/Limits#ifd_value_size.: usize, |
| 475 |
/// Maximum size for intermediate buffer which may be used to limit the amount of data read per |
| 476 |
/// segment even if the entire image is decoded at once. |
| 477 |
pub intermediate_buffer_sizerust-analyzer cargo tiff 0.11.3 decoder/Limits#intermediate_buffer_size.: usize, |
| 478 |
} |
| 479 |
|
| 480 |
impl Limitsrust-analyzer cargo tiff 0.11.3 decoder/Limits# { |
| 481 |
/// A configuration that does not impose any limits. |
| 482 |
/// |
| 483 |
/// This is a good start if the caller only wants to impose selective limits, contrary to the |
| 484 |
/// default limits which allows selectively disabling limits. |
| 485 |
/// |
| 486 |
/// Note that this configuration is likely to crash on excessively large images since, |
| 487 |
/// naturally, the machine running the program does not have infinite memory. |
| 488 |
pub fn unlimitedrust-analyzer cargo tiff 0.11.3 decoder/impl#[Limits]unlimited().() -> Limitsrust-analyzer cargo tiff 0.11.3 decoder/Limits# { |
| 489 |
Limitsrust-analyzer cargo tiff 0.11.3 decoder/Limits# { |
| 490 |
decoding_buffer_sizerust-analyzer cargo tiff 0.11.3 decoder/Limits#decoding_buffer_size.: usize::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]MAX., |
| 491 |
ifd_value_sizerust-analyzer cargo tiff 0.11.3 decoder/Limits#ifd_value_size.: usize::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]MAX., |
| 492 |
intermediate_buffer_sizerust-analyzer cargo tiff 0.11.3 decoder/Limits#intermediate_buffer_size.: usize::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]MAX., |
| 493 |
} |
| 494 |
} |
| 495 |
} |
| 496 |
|
| 497 |
impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for Limitsrust-analyzer cargo tiff 0.11.3 decoder/Limits# { |
| 498 |
fn defaultrust-analyzer cargo tiff 0.11.3 decoder/impl#[Limits][Default]default().() -> Limitsrust-analyzer cargo tiff 0.11.3 decoder/Limits# { |
| 499 |
Limitsrust-analyzer cargo tiff 0.11.3 decoder/Limits# { |
| 500 |
decoding_buffer_sizerust-analyzer cargo tiff 0.11.3 decoder/Limits#decoding_buffer_size.: 256 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().1024 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().1024, |
| 501 |
intermediate_buffer_sizerust-analyzer cargo tiff 0.11.3 decoder/Limits#intermediate_buffer_size.: 128 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().1024 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().1024, |
| 502 |
ifd_value_sizerust-analyzer cargo tiff 0.11.3 decoder/Limits#ifd_value_size.: 1024 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().1024, |
| 503 |
} |
| 504 |
} |
| 505 |
} |
| 506 |
|
| 507 |
/// The representation of a TIFF decoder |
| 508 |
/// |
| 509 |
/// Currently does not support decoding of interlaced images |
| 510 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 511 |
pub struct Decoderrust-analyzer cargo tiff 0.11.3 decoder/Decoder#<R> |
| 512 |
where |
| 513 |
R: Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read# + Seekrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Seek#, |
| 514 |
{ |
| 515 |
/// There are grouped for borrow checker reasons. This allows us to implement methods that |
| 516 |
/// borrow the stream access and the other fields mutably at the same time. |
| 517 |
value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader.: ValueReaderrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#<R>, |
| 518 |
current_ifdrust-analyzer cargo tiff 0.11.3 decoder/Decoder#current_ifd.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<IfdPointerrust-analyzer cargo tiff 0.11.3 tags/IfdPointer#>, |
| 519 |
next_ifdrust-analyzer cargo tiff 0.11.3 decoder/Decoder#next_ifd.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<IfdPointerrust-analyzer cargo tiff 0.11.3 tags/IfdPointer#>, |
| 520 |
/// The IFDs we visited already in this chain of IFDs. |
| 521 |
ifd_offsetsrust-analyzer cargo tiff 0.11.3 decoder/Decoder#ifd_offsets.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<IfdPointerrust-analyzer cargo tiff 0.11.3 tags/IfdPointer#>, |
| 522 |
/// Map from the ifd into the `ifd_offsets` ordered list. |
| 523 |
seen_ifdsrust-analyzer cargo tiff 0.11.3 decoder/Decoder#seen_ifds.: cyclesrust-analyzer cargo tiff 0.11.3 decoder/cycles/::IfdCyclesrust-analyzer cargo tiff 0.11.3 decoder/cycles/IfdCycles#, |
| 524 |
imagerust-analyzer cargo tiff 0.11.3 decoder/Decoder#image.: Imagerust-analyzer cargo tiff 0.11.3 decoder/image/Image#, |
| 525 |
} |
| 526 |
|
| 527 |
/// All the information needed to read and interpret byte slices from the underlying file, i.e. to |
| 528 |
/// turn an entry of a tag into an `ifd::Value` or otherwise fetch arrays of similar types. Used |
| 529 |
/// only as the type of the field [`Decoder::value_reader`] and passed to submodules. |
| 530 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 531 |
struct ValueReaderrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#<R> { |
| 532 |
readerrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#reader.: EndianReaderrust-analyzer cargo tiff 0.11.3 decoder/stream/EndianReader#<R>, |
| 533 |
bigtiffrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#bigtiff.: bool, |
| 534 |
limitsrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#limits.: Limitsrust-analyzer cargo tiff 0.11.3 decoder/Limits#, |
| 535 |
} |
| 536 |
|
| 537 |
/// Reads a directory's tag values from an underlying stream. |
| 538 |
pub struct IfdDecoderrust-analyzer cargo tiff 0.11.3 decoder/IfdDecoder#<'lt> { |
| 539 |
innerrust-analyzer cargo tiff 0.11.3 decoder/IfdDecoder#inner.: tag_readerrust-analyzer cargo tiff 0.11.3 decoder/tag_reader/::TagReaderrust-analyzer cargo tiff 0.11.3 decoder/tag_reader/TagReader#<'lt, dyn tag_readerrust-analyzer cargo tiff 0.11.3 decoder/tag_reader/::EntryDecoderrust-analyzer cargo tiff 0.11.3 decoder/tag_reader/EntryDecoder# + 'lt>, |
| 540 |
} |
| 541 |
|
| 542 |
fn rev_hpredict_nsamprust-analyzer cargo tiff 0.11.3 decoder/rev_hpredict_nsamp().(buf: &mut [u8], bit_depth: u8, samples: u16) { |
| 543 |
fn one_byte_predictrust-analyzer cargo tiff 0.11.3 decoder/one_byte_predict().<const N: usize>(buf: &mut [u8]) { |
| 544 |
for i in N..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#buf.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() { |
| 545 |
buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut(). = buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().(buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().N]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 546 |
} |
| 547 |
} |
| 548 |
|
| 549 |
fn two_bytes_predictrust-analyzer cargo tiff 0.11.3 decoder/two_bytes_predict().<const N: usize>(buf: &mut [u8]) { |
| 550 |
for i in (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().N..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#buf.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()).step_byrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#step_by().(2) { |
| 551 |
let v = u16::from_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]from_ne_bytes().(buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`Index<I>`]index()..try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()); |
| 552 |
let p = u16::from_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]from_ne_bytes().(buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().2 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().N..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`Index<I>`]index()..try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()); |
| 553 |
buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().i..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut()..copy_from_slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]copy_from_slice().(&(v.wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]wrapping_add().(p)).to_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]to_ne_bytes().()); |
| 554 |
} |
| 555 |
} |
| 556 |
|
| 557 |
fn four_bytes_predictrust-analyzer cargo tiff 0.11.3 decoder/four_bytes_predict().<const N: usize>(buf: &mut [u8]) { |
| 558 |
for i in (N rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().4..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#buf.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()).step_byrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#step_by().(4) { |
| 559 |
let v = u32::from_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]from_ne_bytes().(buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`Index<I>`]index()..try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()); |
| 560 |
let p = u32::from_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]from_ne_bytes().(buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().4 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().N..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`Index<I>`]index()..try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()); |
| 561 |
buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().i..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut()..copy_from_slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]copy_from_slice().(&(v.wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]wrapping_add().(p)).to_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]to_ne_bytes().()); |
| 562 |
} |
| 563 |
} |
| 564 |
|
| 565 |
let samples = usize::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[usize][`From<u16>`]from().(samples); |
| 566 |
|
| 567 |
match (bit_depth, samples) { |
| 568 |
// Note we can't use `windows` or so due to the overlap between each iteration. We split |
| 569 |
// the cases by the samples / lookback constant so that each is optimized individually. |
| 570 |
// This is more code generated but each loop can then have a different vectorization |
| 571 |
// strategy. |
| 572 |
(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#8, 1) => one_byte_predictrust-analyzer cargo tiff 0.11.3 decoder/one_byte_predict().::<1>(buf), |
| 573 |
(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#8, 2) => one_byte_predictrust-analyzer cargo tiff 0.11.3 decoder/one_byte_predict().::<2>(buf), |
| 574 |
(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#8, 3) => one_byte_predictrust-analyzer cargo tiff 0.11.3 decoder/one_byte_predict().::<3>(buf), |
| 575 |
(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#8, 4) => one_byte_predictrust-analyzer cargo tiff 0.11.3 decoder/one_byte_predict().::<4>(buf), |
| 576 |
// The generic, sub-optimal case for the above. |
| 577 |
(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#8, _) => { |
| 578 |
for i in samples..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#buf.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() { |
| 579 |
buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut(). = buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().(buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().samples]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 580 |
} |
| 581 |
} |
| 582 |
(9..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#16, 1) => { |
| 583 |
two_bytes_predictrust-analyzer cargo tiff 0.11.3 decoder/two_bytes_predict().::<1>(buf); |
| 584 |
} |
| 585 |
(9..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#16, 2) => { |
| 586 |
two_bytes_predictrust-analyzer cargo tiff 0.11.3 decoder/two_bytes_predict().::<2>(buf); |
| 587 |
} |
| 588 |
(9..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#16, 3) => { |
| 589 |
two_bytes_predictrust-analyzer cargo tiff 0.11.3 decoder/two_bytes_predict().::<3>(buf); |
| 590 |
} |
| 591 |
(9..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#16, 4) => { |
| 592 |
two_bytes_predictrust-analyzer cargo tiff 0.11.3 decoder/two_bytes_predict().::<4>(buf); |
| 593 |
} |
| 594 |
(9..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#16, _) => { |
| 595 |
for i in (samples 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..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#buf.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()).step_byrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#step_by().(2) { |
| 596 |
let v = u16::from_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]from_ne_bytes().(buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`Index<I>`]index()..try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()); |
| 597 |
let p = u16::from_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]from_ne_bytes().(buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().2 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().samples..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`Index<I>`]index()..try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()); |
| 598 |
buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().i..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut()..copy_from_slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]copy_from_slice().(&(v.wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]wrapping_add().(p)).to_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]to_ne_bytes().()); |
| 599 |
} |
| 600 |
} |
| 601 |
(17..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#32, 1) => { |
| 602 |
four_bytes_predictrust-analyzer cargo tiff 0.11.3 decoder/four_bytes_predict().::<1>(buf); |
| 603 |
} |
| 604 |
(17..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#32, 2) => { |
| 605 |
four_bytes_predictrust-analyzer cargo tiff 0.11.3 decoder/four_bytes_predict().::<2>(buf); |
| 606 |
} |
| 607 |
(17..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#32, 3) => { |
| 608 |
four_bytes_predictrust-analyzer cargo tiff 0.11.3 decoder/four_bytes_predict().::<3>(buf); |
| 609 |
} |
| 610 |
(17..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#32, 4) => { |
| 611 |
four_bytes_predictrust-analyzer cargo tiff 0.11.3 decoder/four_bytes_predict().::<4>(buf); |
| 612 |
} |
| 613 |
(17..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#32, _) => { |
| 614 |
for i in (samples rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().4..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#buf.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()).step_byrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#step_by().(4) { |
| 615 |
let v = u32::from_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]from_ne_bytes().(buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`Index<I>`]index()..try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()); |
| 616 |
let p = u32::from_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]from_ne_bytes().(buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().4 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().samples..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`Index<I>`]index()..try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()); |
| 617 |
buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().i..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut()..copy_from_slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]copy_from_slice().(&(v.wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]wrapping_add().(p)).to_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]to_ne_bytes().()); |
| 618 |
} |
| 619 |
} |
| 620 |
(33..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#64, _) => { |
| 621 |
for i in (samples 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().8..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#buf.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()).step_byrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#step_by().(8) { |
| 622 |
let v = u64::from_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u64]from_ne_bytes().(buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#8]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`Index<I>`]index()..try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()); |
| 623 |
let p = u64::from_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u64]from_ne_bytes().(buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().samples..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#8]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`Index<I>`]index()..try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()); |
| 624 |
buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().i..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#8]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut()..copy_from_slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]copy_from_slice().(&(v.wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u64]wrapping_add().(p)).to_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u64]to_ne_bytes().()); |
| 625 |
} |
| 626 |
} |
| 627 |
_ => { |
| 628 |
unreachablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/unreachable!!("Caller should have validated arguments. Please file a bug.") |
| 629 |
} |
| 630 |
} |
| 631 |
} |
| 632 |
|
| 633 |
fn predict_f32rust-analyzer cargo tiff 0.11.3 decoder/predict_f32().(input: &mut [u8], output: &mut [u8], samples: u16) { |
| 634 |
let samples = usize::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[usize][`From<u16>`]from().(samples); |
| 635 |
|
| 636 |
for i in samples..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#input.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() { |
| 637 |
input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut(). = input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().(input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().samples]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 638 |
} |
| 639 |
|
| 640 |
for (i, chunk) in output.chunks_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]chunks_mut().(4).enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() { |
| 641 |
chunk.copy_from_slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]copy_from_slice().(&u32::to_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]to_ne_bytes().(u32::from_be_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]from_be_bytes().([ |
| 642 |
input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 643 |
input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().input.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][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().4 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().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 644 |
input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().input.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][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().4 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().2 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().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 645 |
input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().input.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][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().4 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().3 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().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 646 |
]))); |
| 647 |
} |
| 648 |
} |
| 649 |
|
| 650 |
fn predict_f16rust-analyzer cargo tiff 0.11.3 decoder/predict_f16().(input: &mut [u8], output: &mut [u8], samples: u16) { |
| 651 |
let samples = usize::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[usize][`From<u16>`]from().(samples); |
| 652 |
|
| 653 |
for i in samples..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#input.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() { |
| 654 |
input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut(). = input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().(input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().samples]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 655 |
} |
| 656 |
|
| 657 |
for (i, chunk) in output.chunks_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]chunks_mut().(2).enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() { |
| 658 |
chunk.copy_from_slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]copy_from_slice().(&u16::to_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]to_ne_bytes().(u16::from_be_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]from_be_bytes().([ |
| 659 |
input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 660 |
input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().input.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][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`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().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 661 |
]))); |
| 662 |
} |
| 663 |
} |
| 664 |
|
| 665 |
fn predict_f64rust-analyzer cargo tiff 0.11.3 decoder/predict_f64().(input: &mut [u8], output: &mut [u8], samples: u16) { |
| 666 |
let samples = usize::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[usize][`From<u16>`]from().(samples); |
| 667 |
|
| 668 |
for i in samples..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#input.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() { |
| 669 |
input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut(). = input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().(input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().samples]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 670 |
} |
| 671 |
|
| 672 |
for (i, chunk) in output.chunks_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]chunks_mut().(8).enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() { |
| 673 |
chunk.copy_from_slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]copy_from_slice().(&u64::to_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u64]to_ne_bytes().(u64::from_be_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u64]from_be_bytes().([ |
| 674 |
input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 675 |
input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().input.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][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().8 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().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 676 |
input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().input.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][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().2 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().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 677 |
input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().input.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][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().3 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().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 678 |
input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().input.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][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().4 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().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 679 |
input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().input.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][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().5 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().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 680 |
input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().input.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][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().6 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().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 681 |
input[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().input.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][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().7 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().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 682 |
]))); |
| 683 |
} |
| 684 |
} |
| 685 |
|
| 686 |
fn fix_endianness_and_predictrust-analyzer cargo tiff 0.11.3 decoder/fix_endianness_and_predict().( |
| 687 |
buf: &mut [u8], |
| 688 |
bit_depth: u8, |
| 689 |
samples: u16, |
| 690 |
byte_order: ByteOrderrust-analyzer cargo tiff 0.11.3 tags/ByteOrder#, |
| 691 |
predictor: Predictorrust-analyzer cargo tiff 0.11.3 tags/Predictor#, |
| 692 |
) { |
| 693 |
match predictor { |
| 694 |
Predictorrust-analyzer cargo tiff 0.11.3 tags/Predictor#::Nonerust-analyzer cargo tiff 0.11.3 tags/Predictor#None# => { |
| 695 |
fix_endiannessrust-analyzer cargo tiff 0.11.3 decoder/fix_endianness().(buf, byte_order, bit_depth); |
| 696 |
} |
| 697 |
Predictorrust-analyzer cargo tiff 0.11.3 tags/Predictor#::Horizontalrust-analyzer cargo tiff 0.11.3 tags/Predictor#Horizontal# => { |
| 698 |
fix_endiannessrust-analyzer cargo tiff 0.11.3 decoder/fix_endianness().(buf, byte_order, bit_depth); |
| 699 |
rev_hpredict_nsamprust-analyzer cargo tiff 0.11.3 decoder/rev_hpredict_nsamp().(buf, bit_depth, samples); |
| 700 |
} |
| 701 |
Predictorrust-analyzer cargo tiff 0.11.3 tags/Predictor#::FloatingPointrust-analyzer cargo tiff 0.11.3 tags/Predictor#FloatingPoint# => { |
| 702 |
let mut buffer_copy = buf.to_vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]to_vec().(); |
| 703 |
match bit_depth { |
| 704 |
16 => predict_f16rust-analyzer cargo tiff 0.11.3 decoder/predict_f16().(&mut buffer_copy, buf, samples), |
| 705 |
32 => predict_f32rust-analyzer cargo tiff 0.11.3 decoder/predict_f32().(&mut buffer_copy, buf, samples), |
| 706 |
64 => predict_f64rust-analyzer cargo tiff 0.11.3 decoder/predict_f64().(&mut buffer_copy, buf, samples), |
| 707 |
_ => unreachablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/unreachable!!("Caller should have validated arguments. Please file a bug."), |
| 708 |
} |
| 709 |
} |
| 710 |
} |
| 711 |
} |
| 712 |
|
| 713 |
fn invert_colorsrust-analyzer cargo tiff 0.11.3 decoder/invert_colors().( |
| 714 |
buf: &mut [u8], |
| 715 |
color_type: ColorTyperust-analyzer cargo tiff 0.11.3 ColorType#, |
| 716 |
sample_format: SampleFormatrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#, |
| 717 |
) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> { |
| 718 |
match (color_type, sample_format) { |
| 719 |
// Where pixels do not cross a byte boundary |
| 720 |
(ColorTyperust-analyzer cargo tiff 0.11.3 ColorType#::Grayrust-analyzer cargo tiff 0.11.3 ColorType#Gray#(1 | 2 | 4 | 8), SampleFormatrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#::Uintrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#Uint#) => { |
| 721 |
for x in buf { |
| 722 |
// Equivalent to both of the following: |
| 723 |
// |
| 724 |
// *x = 0xff - *x |
| 725 |
// *x = !*x |
| 726 |
// |
| 727 |
// since -x = !x+1 |
| 728 |
*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().x = !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][Not]not().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().x; |
| 729 |
} |
| 730 |
} |
| 731 |
(ColorTyperust-analyzer cargo tiff 0.11.3 ColorType#::Grayrust-analyzer cargo tiff 0.11.3 ColorType#Gray#(16), SampleFormatrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#::Uintrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#Uint#) => { |
| 732 |
for x in buf.chunks_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]chunks_mut().(2) { |
| 733 |
let v = u16::from_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]from_ne_bytes().(x.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()); |
| 734 |
x.copy_from_slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]copy_from_slice().(&(0xffff rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().v).to_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]to_ne_bytes().()); |
| 735 |
} |
| 736 |
} |
| 737 |
(ColorTyperust-analyzer cargo tiff 0.11.3 ColorType#::Grayrust-analyzer cargo tiff 0.11.3 ColorType#Gray#(32), SampleFormatrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#::Uintrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#Uint#) => { |
| 738 |
for x in buf.chunks_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]chunks_mut().(4) { |
| 739 |
let v = u32::from_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]from_ne_bytes().(x.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()); |
| 740 |
x.copy_from_slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]copy_from_slice().(&(0xffff_ffff rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().v).to_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]to_ne_bytes().()); |
| 741 |
} |
| 742 |
} |
| 743 |
(ColorTyperust-analyzer cargo tiff 0.11.3 ColorType#::Grayrust-analyzer cargo tiff 0.11.3 ColorType#Gray#(64), SampleFormatrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#::Uintrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#Uint#) => { |
| 744 |
for x in buf.chunks_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]chunks_mut().(8) { |
| 745 |
let v = u64::from_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u64]from_ne_bytes().(x.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()); |
| 746 |
x.copy_from_slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]copy_from_slice().(&(0xffff_ffff_ffff_ffff rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Sub<Self>`]sub().v).to_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u64]to_ne_bytes().()); |
| 747 |
} |
| 748 |
} |
| 749 |
(ColorTyperust-analyzer cargo tiff 0.11.3 ColorType#::Grayrust-analyzer cargo tiff 0.11.3 ColorType#Gray#(32), SampleFormatrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#::IEEEFPrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#IEEEFP#) => { |
| 750 |
for x in buf.chunks_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]chunks_mut().(4) { |
| 751 |
let v = f32::from_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]from_ne_bytes().(x.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()); |
| 752 |
x.copy_from_slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]copy_from_slice().(&(1.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().v).to_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]to_ne_bytes().()); |
| 753 |
} |
| 754 |
} |
| 755 |
(ColorTyperust-analyzer cargo tiff 0.11.3 ColorType#::Grayrust-analyzer cargo tiff 0.11.3 ColorType#Gray#(64), SampleFormatrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#::IEEEFPrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#IEEEFP#) => { |
| 756 |
for x in buf.chunks_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]chunks_mut().(8) { |
| 757 |
let v = f64::from_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]from_ne_bytes().(x.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()); |
| 758 |
x.copy_from_slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]copy_from_slice().(&(1.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub().v).to_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]to_ne_bytes().()); |
| 759 |
} |
| 760 |
} |
| 761 |
_ => { |
| 762 |
return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(TiffErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#::UnsupportedErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#UnsupportedError#( |
| 763 |
TiffUnsupportedErrorrust-analyzer cargo tiff 0.11.3 error/TiffUnsupportedError#::UnknownInterpretationrust-analyzer cargo tiff 0.11.3 error/TiffUnsupportedError#UnknownInterpretation#, |
| 764 |
)) |
| 765 |
} |
| 766 |
} |
| 767 |
|
| 768 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 769 |
} |
| 770 |
|
| 771 |
/// Fix endianness. If `byte_order` matches the host, then conversion is a no-op. |
| 772 |
fn fix_endiannessrust-analyzer cargo tiff 0.11.3 decoder/fix_endianness().(buf: &mut [u8], byte_order: ByteOrderrust-analyzer cargo tiff 0.11.3 tags/ByteOrder#, bit_depth: u8) { |
| 773 |
let host = ByteOrderrust-analyzer cargo tiff 0.11.3 tags/ByteOrder#::nativerust-analyzer cargo tiff 0.11.3 tags/impl#[ByteOrder]native().(); |
| 774 |
|
| 775 |
let class = match bit_depth { |
| 776 |
0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#8 => craterust-analyzer cargo tiff 0.11.3 crate/::tagsrust-analyzer cargo tiff 0.11.3 tags/::EndianBytesrust-analyzer cargo tiff 0.11.3 tags/EndianBytes#::Onerust-analyzer cargo tiff 0.11.3 tags/EndianBytes#One#, |
| 777 |
9..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#16 => craterust-analyzer cargo tiff 0.11.3 crate/::tagsrust-analyzer cargo tiff 0.11.3 tags/::EndianBytesrust-analyzer cargo tiff 0.11.3 tags/EndianBytes#::Tworust-analyzer cargo tiff 0.11.3 tags/EndianBytes#Two#, |
| 778 |
17..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#32 => craterust-analyzer cargo tiff 0.11.3 crate/::tagsrust-analyzer cargo tiff 0.11.3 tags/::EndianBytesrust-analyzer cargo tiff 0.11.3 tags/EndianBytes#::Fourrust-analyzer cargo tiff 0.11.3 tags/EndianBytes#Four#, |
| 779 |
_ => craterust-analyzer cargo tiff 0.11.3 crate/::tagsrust-analyzer cargo tiff 0.11.3 tags/::EndianBytesrust-analyzer cargo tiff 0.11.3 tags/EndianBytes#::Eightrust-analyzer cargo tiff 0.11.3 tags/EndianBytes#Eight#, |
| 780 |
}; |
| 781 |
|
| 782 |
host.convert_endian_bytesrust-analyzer cargo tiff 0.11.3 tags/impl#[ByteOrder]convert_endian_bytes().(class, buf, byte_order); |
| 783 |
} |
| 784 |
|
| 785 |
impl<R: Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read# + Seekrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Seek#> Decoderrust-analyzer cargo tiff 0.11.3 decoder/Decoder#<R> { |
| 786 |
pub fn newrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]new().(mut r: R) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Decoderrust-analyzer cargo tiff 0.11.3 decoder/Decoder#<R>> { |
| 787 |
let mut endianess = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(2); |
| 788 |
(&mut r).takerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#take().(2).read_to_endrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#read_to_end().(&mut endianess)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 789 |
let byte_order = match &*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Deref]deref().endianess { |
| 790 |
b"II" => ByteOrderrust-analyzer cargo tiff 0.11.3 tags/ByteOrder#::LittleEndianrust-analyzer cargo tiff 0.11.3 tags/ByteOrder#LittleEndian#, |
| 791 |
b"MM" => ByteOrderrust-analyzer cargo tiff 0.11.3 tags/ByteOrder#::BigEndianrust-analyzer cargo tiff 0.11.3 tags/ByteOrder#BigEndian#, |
| 792 |
_ => { |
| 793 |
return 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#( |
| 794 |
TiffFormatErrorrust-analyzer cargo tiff 0.11.3 error/TiffFormatError#::TiffSignatureNotFoundrust-analyzer cargo tiff 0.11.3 error/TiffFormatError#TiffSignatureNotFound#, |
| 795 |
)) |
| 796 |
} |
| 797 |
}; |
| 798 |
let mut reader = EndianReaderrust-analyzer cargo tiff 0.11.3 decoder/stream/EndianReader#::newrust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]new().(r, byte_order); |
| 799 |
|
| 800 |
let bigtiff = match reader.read_u16rust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]read_u16().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). { |
| 801 |
42 => false, |
| 802 |
43 => { |
| 803 |
// Read bytesize of offsets (in bigtiff it's alway 8 but provide a way to move to 16 some day) |
| 804 |
if reader.read_u16rust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]read_u16().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne().8 { |
| 805 |
return 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#( |
| 806 |
TiffFormatErrorrust-analyzer cargo tiff 0.11.3 error/TiffFormatError#::TiffSignatureNotFoundrust-analyzer cargo tiff 0.11.3 error/TiffFormatError#TiffSignatureNotFound#, |
| 807 |
)); |
| 808 |
} |
| 809 |
// This constant should always be 0 |
| 810 |
if reader.read_u16rust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]read_u16().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne().0 { |
| 811 |
return 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#( |
| 812 |
TiffFormatErrorrust-analyzer cargo tiff 0.11.3 error/TiffFormatError#::TiffSignatureNotFoundrust-analyzer cargo tiff 0.11.3 error/TiffFormatError#TiffSignatureNotFound#, |
| 813 |
)); |
| 814 |
} |
| 815 |
true |
| 816 |
} |
| 817 |
_ => { |
| 818 |
return 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#( |
| 819 |
TiffFormatErrorrust-analyzer cargo tiff 0.11.3 error/TiffFormatError#::TiffSignatureInvalidrust-analyzer cargo tiff 0.11.3 error/TiffFormatError#TiffSignatureInvalid#, |
| 820 |
)) |
| 821 |
} |
| 822 |
}; |
| 823 |
|
| 824 |
let next_ifd = if bigtiff { |
| 825 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(reader.read_u64rust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]read_u64().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().) |
| 826 |
} else { |
| 827 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(u64::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u64][`From<u32>`]from().(reader.read_u32rust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]read_u32().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)) |
| 828 |
} |
| 829 |
.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(IfdPointerrust-analyzer cargo tiff 0.11.3 tags/IfdPointer#); |
| 830 |
|
| 831 |
let current_ifd = *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().next_ifd.as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 832 |
let ifd_offsets = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![current_ifd]; |
| 833 |
|
| 834 |
let mut decoder = Decoderrust-analyzer cargo tiff 0.11.3 decoder/Decoder# { |
| 835 |
value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader.: ValueReaderrust-analyzer cargo tiff 0.11.3 decoder/ValueReader# { |
| 836 |
readerrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#reader., |
| 837 |
bigtiffrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#bigtiff., |
| 838 |
limitsrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#limits.: Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo tiff 0.11.3 decoder/impl#[Limits][Default]default().(), |
| 839 |
}, |
| 840 |
next_ifdrust-analyzer cargo tiff 0.11.3 decoder/Decoder#next_ifd., |
| 841 |
ifd_offsetsrust-analyzer cargo tiff 0.11.3 decoder/Decoder#ifd_offsets., |
| 842 |
current_ifdrust-analyzer cargo tiff 0.11.3 decoder/Decoder#current_ifd.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 843 |
seen_ifdsrust-analyzer cargo tiff 0.11.3 decoder/Decoder#seen_ifds.: cyclesrust-analyzer cargo tiff 0.11.3 decoder/cycles/::IfdCyclesrust-analyzer cargo tiff 0.11.3 decoder/cycles/IfdCycles#::newrust-analyzer cargo tiff 0.11.3 decoder/cycles/impl#[IfdCycles]new().(), |
| 844 |
imagerust-analyzer cargo tiff 0.11.3 decoder/Decoder#image.: Imagerust-analyzer cargo tiff 0.11.3 decoder/image/Image# { |
| 845 |
ifdrust-analyzer cargo tiff 0.11.3 decoder/image/Image#ifd.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 846 |
widthrust-analyzer cargo tiff 0.11.3 decoder/image/Image#width.: 0, |
| 847 |
heightrust-analyzer cargo tiff 0.11.3 decoder/image/Image#height.: 0, |
| 848 |
bits_per_samplerust-analyzer cargo tiff 0.11.3 decoder/image/Image#bits_per_sample.: 1, |
| 849 |
samplesrust-analyzer cargo tiff 0.11.3 decoder/image/Image#samples.: 1, |
| 850 |
extra_samplesrust-analyzer cargo tiff 0.11.3 decoder/image/Image#extra_samples.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 851 |
photometric_samplesrust-analyzer cargo tiff 0.11.3 decoder/image/Image#photometric_samples.: 1, |
| 852 |
sample_formatrust-analyzer cargo tiff 0.11.3 decoder/image/Image#sample_format.: SampleFormatrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#::Uintrust-analyzer cargo tiff 0.11.3 tags/SampleFormat#Uint#, |
| 853 |
photometric_interpretationrust-analyzer cargo tiff 0.11.3 decoder/image/Image#photometric_interpretation.: PhotometricInterpretationrust-analyzer cargo tiff 0.11.3 tags/PhotometricInterpretation#::BlackIsZerorust-analyzer cargo tiff 0.11.3 tags/PhotometricInterpretation#BlackIsZero#, |
| 854 |
compression_methodrust-analyzer cargo tiff 0.11.3 decoder/image/Image#compression_method.: CompressionMethodrust-analyzer cargo tiff 0.11.3 tags/CompressionMethod#::Nonerust-analyzer cargo tiff 0.11.3 tags/CompressionMethod#None#, |
| 855 |
jpeg_tablesrust-analyzer cargo tiff 0.11.3 decoder/image/Image#jpeg_tables.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 856 |
predictorrust-analyzer cargo tiff 0.11.3 decoder/image/Image#predictor.: Predictorrust-analyzer cargo tiff 0.11.3 tags/Predictor#::Nonerust-analyzer cargo tiff 0.11.3 tags/Predictor#None#, |
| 857 |
chunk_typerust-analyzer cargo tiff 0.11.3 decoder/image/Image#chunk_type.: ChunkTyperust-analyzer cargo tiff 0.11.3 decoder/ChunkType#::Striprust-analyzer cargo tiff 0.11.3 decoder/ChunkType#Strip#, |
| 858 |
planar_configrust-analyzer cargo tiff 0.11.3 decoder/image/Image#planar_config.: PlanarConfigurationrust-analyzer cargo tiff 0.11.3 tags/PlanarConfiguration#::Chunkyrust-analyzer cargo tiff 0.11.3 tags/PlanarConfiguration#Chunky#, |
| 859 |
strip_decoderrust-analyzer cargo tiff 0.11.3 decoder/image/Image#strip_decoder.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 860 |
tile_attributesrust-analyzer cargo tiff 0.11.3 decoder/image/Image#tile_attributes.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 861 |
chunk_offsetsrust-analyzer cargo tiff 0.11.3 decoder/image/Image#chunk_offsets.: 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().(), |
| 862 |
chunk_bytesrust-analyzer cargo tiff 0.11.3 decoder/image/Image#chunk_bytes.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(), |
| 863 |
chroma_subsamplingrust-analyzer cargo tiff 0.11.3 decoder/image/Image#chroma_subsampling.: (2, 2), |
| 864 |
}, |
| 865 |
}; |
| 866 |
decoder.next_imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]next_image().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 867 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(decoder) |
| 868 |
} |
| 869 |
|
| 870 |
pub fn with_limitsrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]with_limits().(mut self, limits: Limitsrust-analyzer cargo tiff 0.11.3 decoder/Limits#) -> Decoderrust-analyzer cargo tiff 0.11.3 decoder/Decoder#<R> { |
| 871 |
self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader..limitsrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#limits. = limits; |
| 872 |
self |
| 873 |
} |
| 874 |
|
| 875 |
pub fn dimensionsrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]dimensions().(&mut self) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<(u32, u32)> { |
| 876 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().widthrust-analyzer cargo tiff 0.11.3 decoder/image/Image#width., self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().heightrust-analyzer cargo tiff 0.11.3 decoder/image/Image#height.)) |
| 877 |
} |
| 878 |
|
| 879 |
pub fn colortyperust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]colortype().(&mut self) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<ColorTyperust-analyzer cargo tiff 0.11.3 ColorType#> { |
| 880 |
self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().colortyperust-analyzer cargo tiff 0.11.3 decoder/image/impl#[Image]colortype().() |
| 881 |
} |
| 882 |
|
| 883 |
/// The offset of the directory representing the current image. |
| 884 |
pub fn ifd_pointerrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]ifd_pointer().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<IfdPointerrust-analyzer cargo tiff 0.11.3 tags/IfdPointer#> { |
| 885 |
self.current_ifdrust-analyzer cargo tiff 0.11.3 decoder/Decoder#current_ifd. |
| 886 |
} |
| 887 |
|
| 888 |
fn imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().(&self) -> &Imagerust-analyzer cargo tiff 0.11.3 decoder/image/Image# { |
| 889 |
&self.imagerust-analyzer cargo tiff 0.11.3 decoder/Decoder#image. |
| 890 |
} |
| 891 |
|
| 892 |
/// Loads the IFD at the specified index in the list, if one exists |
| 893 |
pub fn seek_to_imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]seek_to_image().(&mut self, ifd_index: usize) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> { |
| 894 |
// Check whether we have seen this IFD before, if so then the index will be less than the length of the list of ifd offsets |
| 895 |
if ifd_index rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().self.ifd_offsetsrust-analyzer cargo tiff 0.11.3 decoder/Decoder#ifd_offsets..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() { |
| 896 |
// We possibly need to load in the next IFD |
| 897 |
if self.next_ifdrust-analyzer cargo tiff 0.11.3 decoder/Decoder#next_ifd..is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().() { |
| 898 |
self.current_ifdrust-analyzer cargo tiff 0.11.3 decoder/Decoder#current_ifd. = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 899 |
|
| 900 |
return 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#( |
| 901 |
TiffFormatErrorrust-analyzer cargo tiff 0.11.3 error/TiffFormatError#::ImageFileDirectoryNotFoundrust-analyzer cargo tiff 0.11.3 error/TiffFormatError#ImageFileDirectoryNotFound#, |
| 902 |
)); |
| 903 |
} |
| 904 |
|
| 905 |
loop { |
| 906 |
// Follow the list until we find the one we want, or we reach the end, whichever happens first |
| 907 |
let ifd = self.next_ifdrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]next_ifd().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 908 |
|
| 909 |
if ifd.nextrust-analyzer cargo tiff 0.11.3 directory/impl#[Directory]next().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().() { |
| 910 |
break; |
| 911 |
} |
| 912 |
|
| 913 |
if ifd_index rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().self.ifd_offsetsrust-analyzer cargo tiff 0.11.3 decoder/Decoder#ifd_offsets..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() { |
| 914 |
break; |
| 915 |
} |
| 916 |
} |
| 917 |
} |
| 918 |
|
| 919 |
// If the index is within the list of ifds then we can load the selected image/IFD |
| 920 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ifd_offset) = self.ifd_offsetsrust-analyzer cargo tiff 0.11.3 decoder/Decoder#ifd_offsets..getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(ifd_index) { |
| 921 |
let ifd = self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader..read_directoryrust-analyzer cargo tiff 0.11.3 decoder/impl#[`ValueReader<R>`]read_directory().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().ifd_offset)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 922 |
self.next_ifdrust-analyzer cargo tiff 0.11.3 decoder/Decoder#next_ifd. = ifd.nextrust-analyzer cargo tiff 0.11.3 directory/impl#[Directory]next().(); |
| 923 |
self.current_ifdrust-analyzer cargo tiff 0.11.3 decoder/Decoder#current_ifd. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().ifd_offset); |
| 924 |
self.imagerust-analyzer cargo tiff 0.11.3 decoder/Decoder#image. = Imagerust-analyzer cargo tiff 0.11.3 decoder/image/Image#::from_readerrust-analyzer cargo tiff 0.11.3 decoder/image/impl#[Image]from_reader().(&mut self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader., ifd)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 925 |
|
| 926 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 927 |
} else { |
| 928 |
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#( |
| 929 |
TiffFormatErrorrust-analyzer cargo tiff 0.11.3 error/TiffFormatError#::ImageFileDirectoryNotFoundrust-analyzer cargo tiff 0.11.3 error/TiffFormatError#ImageFileDirectoryNotFound#, |
| 930 |
)) |
| 931 |
} |
| 932 |
} |
| 933 |
|
| 934 |
fn next_ifdrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]next_ifd().(&mut self) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Directoryrust-analyzer cargo tiff 0.11.3 directory/Directory#> { |
| 935 |
let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(next_ifd) = self.next_ifdrust-analyzer cargo tiff 0.11.3 decoder/Decoder#next_ifd..takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]take().() else { |
| 936 |
return 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#( |
| 937 |
TiffFormatErrorrust-analyzer cargo tiff 0.11.3 error/TiffFormatError#::ImageFileDirectoryNotFoundrust-analyzer cargo tiff 0.11.3 error/TiffFormatError#ImageFileDirectoryNotFound#, |
| 938 |
)); |
| 939 |
}; |
| 940 |
|
| 941 |
let ifd = self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader..read_directoryrust-analyzer cargo tiff 0.11.3 decoder/impl#[`ValueReader<R>`]read_directory().(next_ifd)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 942 |
|
| 943 |
// Ensure this walk does not get us into a cycle. |
| 944 |
self.seen_ifdsrust-analyzer cargo tiff 0.11.3 decoder/Decoder#seen_ifds..insert_nextrust-analyzer cargo tiff 0.11.3 decoder/cycles/impl#[IfdCycles]insert_next().(next_ifd, ifd.nextrust-analyzer cargo tiff 0.11.3 directory/impl#[Directory]next().())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 945 |
|
| 946 |
// Extend the list of known IFD offsets in this chain, if needed. |
| 947 |
if self.ifd_offsetsrust-analyzer cargo tiff 0.11.3 decoder/Decoder#ifd_offsets..lastrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]last().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<&T>`]copied().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().self.current_ifdrust-analyzer cargo tiff 0.11.3 decoder/Decoder#current_ifd. { |
| 948 |
self.ifd_offsetsrust-analyzer cargo tiff 0.11.3 decoder/Decoder#ifd_offsets..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(next_ifd); |
| 949 |
} |
| 950 |
|
| 951 |
self.current_ifdrust-analyzer cargo tiff 0.11.3 decoder/Decoder#current_ifd. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(next_ifd); |
| 952 |
self.next_ifdrust-analyzer cargo tiff 0.11.3 decoder/Decoder#next_ifd. = ifd.nextrust-analyzer cargo tiff 0.11.3 directory/impl#[Directory]next().(); |
| 953 |
|
| 954 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ifd) |
| 955 |
} |
| 956 |
|
| 957 |
/// Reads in the next image. |
| 958 |
/// If there is no further image in the TIFF file a format error is returned. |
| 959 |
/// To determine whether there are more images call `TIFFDecoder::more_images` instead. |
| 960 |
pub fn next_imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]next_image().(&mut self) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> { |
| 961 |
let ifd = self.next_ifdrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]next_ifd().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 962 |
self.imagerust-analyzer cargo tiff 0.11.3 decoder/Decoder#image. = Imagerust-analyzer cargo tiff 0.11.3 decoder/image/Image#::from_readerrust-analyzer cargo tiff 0.11.3 decoder/image/impl#[Image]from_reader().(&mut self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader., ifd)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 963 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 964 |
} |
| 965 |
|
| 966 |
/// Returns `true` if there is at least one more image available. |
| 967 |
pub fn more_imagesrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]more_images().(&self) -> bool { |
| 968 |
self.next_ifdrust-analyzer cargo tiff 0.11.3 decoder/Decoder#next_ifd..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() |
| 969 |
} |
| 970 |
|
| 971 |
/// Returns the byte_order of the file. |
| 972 |
/// |
| 973 |
/// # Usage |
| 974 |
/// |
| 975 |
/// This is only relevant to interpreting raw bytes read from tags. The image decoding methods |
| 976 |
/// will correct to the host byte order automatically. |
| 977 |
pub fn byte_orderrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]byte_order().(&self) -> ByteOrderrust-analyzer cargo tiff 0.11.3 tags/ByteOrder# { |
| 978 |
self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader..readerrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#reader..byte_orderrust-analyzer cargo tiff 0.11.3 decoder/stream/EndianReader#byte_order. |
| 979 |
} |
| 980 |
|
| 981 |
#[inline] |
| 982 |
pub fn read_ifd_offsetrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_ifd_offset().(&mut self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<u64, iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#> { |
| 983 |
if self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader..bigtiffrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#bigtiff. { |
| 984 |
self.read_long8rust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_long8().() |
| 985 |
} else { |
| 986 |
self.read_longrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_long().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(u64::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u64][`From<u32>`]from().) |
| 987 |
} |
| 988 |
} |
| 989 |
|
| 990 |
/// Returns a mutable reference to the stream being decoded. |
| 991 |
pub fn innerrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]inner().(&mut self) -> &mut R { |
| 992 |
self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader..readerrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#reader..innerrust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]inner().() |
| 993 |
} |
| 994 |
|
| 995 |
/// Reads a TIFF byte value |
| 996 |
#[inline] |
| 997 |
pub fn read_byterust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_byte().(&mut self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<u8, iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#> { |
| 998 |
let mut buf = [0; 1]; |
| 999 |
self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader..readerrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#reader..innerrust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]inner().().read_exactrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#read_exact().(&mut buf)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1000 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().) |
| 1001 |
} |
| 1002 |
|
| 1003 |
/// Reads a TIFF short value |
| 1004 |
#[inline] |
| 1005 |
pub fn read_shortrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_short().(&mut self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<u16, iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#> { |
| 1006 |
self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader..readerrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#reader..read_u16rust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]read_u16().() |
| 1007 |
} |
| 1008 |
|
| 1009 |
/// Reads a TIFF sshort value |
| 1010 |
#[inline] |
| 1011 |
pub fn read_sshortrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_sshort().(&mut self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<i16, iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#> { |
| 1012 |
self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader..readerrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#reader..read_i16rust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]read_i16().() |
| 1013 |
} |
| 1014 |
|
| 1015 |
/// Reads a TIFF long value |
| 1016 |
#[inline] |
| 1017 |
pub fn read_longrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_long().(&mut self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<u32, iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#> { |
| 1018 |
self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader..readerrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#reader..read_u32rust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]read_u32().() |
| 1019 |
} |
| 1020 |
|
| 1021 |
/// Reads a TIFF slong value |
| 1022 |
#[inline] |
| 1023 |
pub fn read_slongrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_slong().(&mut self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<i32, iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#> { |
| 1024 |
self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader..readerrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#reader..read_i32rust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]read_i32().() |
| 1025 |
} |
| 1026 |
|
| 1027 |
/// Reads a TIFF float value |
| 1028 |
#[inline] |
| 1029 |
pub fn read_floatrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_float().(&mut self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<f32, iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#> { |
| 1030 |
self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader..readerrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#reader..read_f32rust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]read_f32().() |
| 1031 |
} |
| 1032 |
|
| 1033 |
/// Reads a TIFF double value |
| 1034 |
#[inline] |
| 1035 |
pub fn read_doublerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_double().(&mut self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<f64, iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#> { |
| 1036 |
self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader..readerrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#reader..read_f64rust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]read_f64().() |
| 1037 |
} |
| 1038 |
|
| 1039 |
#[inline] |
| 1040 |
pub fn read_long8rust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_long8().(&mut self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<u64, iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#> { |
| 1041 |
self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader..readerrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#reader..read_u64rust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]read_u64().() |
| 1042 |
} |
| 1043 |
|
| 1044 |
#[inline] |
| 1045 |
pub fn read_slong8rust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_slong8().(&mut self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<i64, iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#> { |
| 1046 |
self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader..readerrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#reader..read_i64rust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]read_i64().() |
| 1047 |
} |
| 1048 |
|
| 1049 |
/// Reads a string |
| 1050 |
#[inline] |
| 1051 |
pub fn read_stringrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_string().(&mut self, length: usize) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> { |
| 1052 |
let mut out = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0; length]; |
| 1053 |
self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader..readerrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#reader..innerrust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]inner().().read_exactrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#read_exact().(&mut out)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1054 |
// Strings may be null-terminated, so we trim anything downstream of the null byte |
| 1055 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(first) = out.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().positionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]position().(|&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) { |
| 1056 |
out.truncaterust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]truncate().(first); |
| 1057 |
} |
| 1058 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::from_utf8rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]from_utf8().(out)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().) |
| 1059 |
} |
| 1060 |
|
| 1061 |
/// Reads a TIFF IFA offset/value field |
| 1062 |
#[inline] |
| 1063 |
pub fn read_offsetrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_offset().(&mut self) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<[u8; 4]> { |
| 1064 |
if self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader..bigtiffrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#bigtiff. { |
| 1065 |
return 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#( |
| 1066 |
TiffFormatErrorrust-analyzer cargo tiff 0.11.3 error/TiffFormatError#::InconsistentSizesEncounteredrust-analyzer cargo tiff 0.11.3 error/TiffFormatError#InconsistentSizesEncountered#, |
| 1067 |
)); |
| 1068 |
} |
| 1069 |
let mut val = [0; 4]; |
| 1070 |
self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader..readerrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#reader..innerrust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]inner().().read_exactrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#read_exact().(&mut val)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1071 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(val) |
| 1072 |
} |
| 1073 |
|
| 1074 |
/// Reads a TIFF IFA offset/value field |
| 1075 |
#[inline] |
| 1076 |
pub fn read_offset_u64rust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_offset_u64().(&mut self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<[u8; 8], iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#> { |
| 1077 |
let mut val = [0; 8]; |
| 1078 |
self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader..readerrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#reader..innerrust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]inner().().read_exactrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#read_exact().(&mut val)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1079 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(val) |
| 1080 |
} |
| 1081 |
|
| 1082 |
/// Moves the cursor to the specified offset |
| 1083 |
#[inline] |
| 1084 |
pub fn goto_offsetrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]goto_offset().(&mut self, offset: u32) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> { |
| 1085 |
self.goto_offset_u64rust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]goto_offset_u64().(offset.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) |
| 1086 |
} |
| 1087 |
|
| 1088 |
#[inline] |
| 1089 |
pub fn goto_offset_u64rust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]goto_offset_u64().(&mut self, offset: u64) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> { |
| 1090 |
self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader..readerrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#reader..goto_offsetrust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]goto_offset().(offset) |
| 1091 |
} |
| 1092 |
|
| 1093 |
/// Read a tag-entry map from a known offset. |
| 1094 |
/// |
| 1095 |
/// A TIFF [`Directory`], aka. image file directory aka. IFD, refers to a map from |
| 1096 |
/// tags–identified by a `u16`–to a typed vector of elements. It is encoded as a list |
| 1097 |
/// of ascending tag values with the offset and type of their corresponding values. The |
| 1098 |
/// semantic interpretations of a tag and its type requirements depend on the context of the |
| 1099 |
/// directory. The main image directories, those iterated over by the `Decoder` after |
| 1100 |
/// construction, are represented by [`Tag`] and [`ifd::Value`]. Other forms are EXIF and GPS |
| 1101 |
/// data as well as thumbnail Sub-IFD representations associated with each image file. |
| 1102 |
/// |
| 1103 |
/// This method allows the decoding of a directory from an arbitrary offset in the image file |
| 1104 |
/// with no specific semantic interpretation. Such an offset is usually found as the value of |
| 1105 |
/// a tag, e.g. [`Tag::SubIfd`], [`Tag::ExifDirectory`], [`Tag::GpsDirectory`] and recovered |
| 1106 |
/// from the associated value by [`ifd::Value::into_ifd_pointer`]. |
| 1107 |
/// |
| 1108 |
/// The library will not verify whether the offset overlaps any other directory or would form a |
| 1109 |
/// cycle with any other directory when calling this method. This will modify the position of |
| 1110 |
/// the reader, i.e. continuing with direct reads at a later point will require going back with |
| 1111 |
/// [`Self::goto_offset`]. |
| 1112 |
pub fn read_directoryrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_directory().(&mut self, ptr: IfdPointerrust-analyzer cargo tiff 0.11.3 tags/IfdPointer#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Directoryrust-analyzer cargo tiff 0.11.3 directory/Directory#> { |
| 1113 |
self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader..read_directoryrust-analyzer cargo tiff 0.11.3 decoder/impl#[`ValueReader<R>`]read_directory().(ptr) |
| 1114 |
} |
| 1115 |
|
| 1116 |
fn check_chunk_typerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]check_chunk_type().(&self, expected: ChunkTyperust-analyzer cargo tiff 0.11.3 decoder/ChunkType#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> { |
| 1117 |
if expected rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().chunk_typerust-analyzer cargo tiff 0.11.3 decoder/image/Image#chunk_type. { |
| 1118 |
return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(TiffErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#::UsageErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#UsageError#(UsageErrorrust-analyzer cargo tiff 0.11.3 error/UsageError#::InvalidChunkTyperust-analyzer cargo tiff 0.11.3 error/UsageError#InvalidChunkType#( |
| 1119 |
expected, |
| 1120 |
self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().chunk_typerust-analyzer cargo tiff 0.11.3 decoder/image/Image#chunk_type., |
| 1121 |
))); |
| 1122 |
} |
| 1123 |
|
| 1124 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 1125 |
} |
| 1126 |
|
| 1127 |
/// The chunk type (Strips / Tiles) of the image |
| 1128 |
pub fn get_chunk_typerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_chunk_type().(&self) -> ChunkTyperust-analyzer cargo tiff 0.11.3 decoder/ChunkType# { |
| 1129 |
self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().chunk_typerust-analyzer cargo tiff 0.11.3 decoder/image/Image#chunk_type. |
| 1130 |
} |
| 1131 |
|
| 1132 |
/// Number of strips in image |
| 1133 |
pub fn strip_countrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]strip_count().(&mut self) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<u32> { |
| 1134 |
self.check_chunk_typerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]check_chunk_type().(ChunkTyperust-analyzer cargo tiff 0.11.3 decoder/ChunkType#::Striprust-analyzer cargo tiff 0.11.3 decoder/ChunkType#Strip#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1135 |
let rows_per_strip = self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().strip_decoderrust-analyzer cargo tiff 0.11.3 decoder/image/Image#strip_decoder..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().rows_per_striprust-analyzer cargo tiff 0.11.3 decoder/image/StripDecodeState#rows_per_strip.; |
| 1136 |
|
| 1137 |
if rows_per_strip rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq().0 { |
| 1138 |
return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0); |
| 1139 |
} |
| 1140 |
|
| 1141 |
// rows_per_strip - 1 can never fail since we know it's at least 1 |
| 1142 |
let height = match self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().heightrust-analyzer cargo tiff 0.11.3 decoder/image/Image#height..checked_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]checked_add().(rows_per_strip rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().1) { |
| 1143 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(h) => h, |
| 1144 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(TiffErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#::IntSizeErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#IntSizeError#), |
| 1145 |
}; |
| 1146 |
|
| 1147 |
let strips = match self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().planar_configrust-analyzer cargo tiff 0.11.3 decoder/image/Image#planar_config. { |
| 1148 |
PlanarConfigurationrust-analyzer cargo tiff 0.11.3 tags/PlanarConfiguration#::Chunkyrust-analyzer cargo tiff 0.11.3 tags/PlanarConfiguration#Chunky# => height rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div().rows_per_strip, |
| 1149 |
PlanarConfigurationrust-analyzer cargo tiff 0.11.3 tags/PlanarConfiguration#::Planarrust-analyzer cargo tiff 0.11.3 tags/PlanarConfiguration#Planar# => height rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div().rows_per_strip rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().samplesrust-analyzer cargo tiff 0.11.3 decoder/image/Image#samples. as u32, |
| 1150 |
}; |
| 1151 |
|
| 1152 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(strips) |
| 1153 |
} |
| 1154 |
|
| 1155 |
/// Number of tiles in image |
| 1156 |
pub fn tile_countrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]tile_count().(&mut self) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<u32> { |
| 1157 |
self.check_chunk_typerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]check_chunk_type().(ChunkTyperust-analyzer cargo tiff 0.11.3 decoder/ChunkType#::Tilerust-analyzer cargo tiff 0.11.3 decoder/ChunkType#Tile#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1158 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(u32::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/ptr_try_from_impls/impl#[u32][`TryFrom<usize>`]try_from().(self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().chunk_offsetsrust-analyzer cargo tiff 0.11.3 decoder/image/Image#chunk_offsets..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().) |
| 1159 |
} |
| 1160 |
|
| 1161 |
fn read_chunk_to_bytesrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_chunk_to_bytes().( |
| 1162 |
&mut self, |
| 1163 |
buffer: &mut [u8], |
| 1164 |
chunk_index: u32, |
| 1165 |
layout: &imagerust-analyzer cargo tiff 0.11.3 decoder/image/::ReadoutLayoutrust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#, |
| 1166 |
) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> { |
| 1167 |
let offset = self.imagerust-analyzer cargo tiff 0.11.3 decoder/Decoder#image..chunk_file_rangerust-analyzer cargo tiff 0.11.3 decoder/image/impl#[Image]chunk_file_range().(chunk_index)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..0; |
| 1168 |
self.goto_offset_u64rust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]goto_offset_u64().(offset)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1169 |
|
| 1170 |
self.imagerust-analyzer cargo tiff 0.11.3 decoder/Decoder#image. |
| 1171 |
.expand_chunkrust-analyzer cargo tiff 0.11.3 decoder/image/impl#[Image]expand_chunk().(&mut self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader., buffer, layout, chunk_index)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1172 |
|
| 1173 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 1174 |
} |
| 1175 |
|
| 1176 |
/// Returns the layout preferred to read the specified chunk with [`Self::read_chunk_bytes`]. |
| 1177 |
/// |
| 1178 |
/// Returns the layout without being specific as to the underlying type for forward |
| 1179 |
/// compatibility. Note that, in general, a TIFF may contain an almost arbitrary number of |
| 1180 |
/// channels of individual *bit* length and format each. |
| 1181 |
/// |
| 1182 |
/// See [`Self::colortype`] to describe the sample types. |
| 1183 |
pub fn image_chunk_buffer_layoutrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image_chunk_buffer_layout().( |
| 1184 |
&mut self, |
| 1185 |
chunk_index: u32, |
| 1186 |
) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<BufferLayoutPreferencerust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#> { |
| 1187 |
let data_dims = self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().chunk_data_dimensionsrust-analyzer cargo tiff 0.11.3 decoder/image/impl#[Image]chunk_data_dimensions().(chunk_index)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1188 |
let readout = self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().readout_for_sizerust-analyzer cargo tiff 0.11.3 decoder/image/impl#[Image]readout_for_size().(data_dims.0, data_dims.1)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1189 |
|
| 1190 |
let extent = readout.result_extent_for_planesrust-analyzer cargo tiff 0.11.3 decoder/impl#[`image::ReadoutLayout`]result_extent_for_planes().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#1)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1191 |
let sample_type = extent.sample_typerust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingExtent]sample_type().(); |
| 1192 |
let layout = extent.preferred_layoutrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingExtent]preferred_layout().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1193 |
|
| 1194 |
let row_stride = corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::numrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/::NonZeroUsizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroUsize#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/impl#[`NonZero<T>`]new().(readout.minimum_row_striderust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#minimum_row_stride.); |
| 1195 |
let plane_stride = corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::numrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/::NonZeroUsizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroUsize#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/impl#[`NonZero<T>`]new().(readout.plane_striderust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#plane_stride.); |
| 1196 |
|
| 1197 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(BufferLayoutPreferencerust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference# { |
| 1198 |
lenrust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#len.: layout.sizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/impl#[Layout]size().(), |
| 1199 |
row_striderust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#row_stride., |
| 1200 |
planesrust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#planes.: 1, |
| 1201 |
plane_striderust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#plane_stride., |
| 1202 |
complete_lenrust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#complete_len.: layout.sizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core alloc/layout/impl#[Layout]size().(), |
| 1203 |
sample_formatrust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#sample_format.: self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().sample_formatrust-analyzer cargo tiff 0.11.3 decoder/image/Image#sample_format., |
| 1204 |
sample_typerust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#sample_type.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(sample_type), |
| 1205 |
}) |
| 1206 |
} |
| 1207 |
|
| 1208 |
/// Return the layout preferred to read several planes corresponding to the specified region. |
| 1209 |
/// |
| 1210 |
/// This is similar to [`Self::image_chunk_buffer_layout`] but can read chunks from all planes |
| 1211 |
/// at the corresponding coordinates of the image. |
| 1212 |
/// |
| 1213 |
/// # Bugs |
| 1214 |
/// |
| 1215 |
/// Sub-sampled images are not yet supported properly. |
| 1216 |
pub fn image_coding_unit_layoutrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image_coding_unit_layout().( |
| 1217 |
&mut self, |
| 1218 |
code_unit: TiffCodingUnitrust-analyzer cargo tiff 0.11.3 decoder/TiffCodingUnit#, |
| 1219 |
) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<BufferLayoutPreferencerust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#> { |
| 1220 |
match self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().planar_configrust-analyzer cargo tiff 0.11.3 decoder/image/Image#planar_config. { |
| 1221 |
PlanarConfigurationrust-analyzer cargo tiff 0.11.3 tags/PlanarConfiguration#::Chunkyrust-analyzer cargo tiff 0.11.3 tags/PlanarConfiguration#Chunky# => return self.image_chunk_buffer_layoutrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image_chunk_buffer_layout().(code_unit.0rust-analyzer cargo tiff 0.11.3 decoder/TiffCodingUnit#0.), |
| 1222 |
PlanarConfigurationrust-analyzer cargo tiff 0.11.3 tags/PlanarConfiguration#::Planarrust-analyzer cargo tiff 0.11.3 tags/PlanarConfiguration#Planar# => {} |
| 1223 |
} |
| 1224 |
|
| 1225 |
let (width, height) = self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().chunk_data_dimensionsrust-analyzer cargo tiff 0.11.3 decoder/image/impl#[Image]chunk_data_dimensions().(code_unit.0rust-analyzer cargo tiff 0.11.3 decoder/TiffCodingUnit#0.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1226 |
|
| 1227 |
let layout = self |
| 1228 |
.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().() |
| 1229 |
.readout_for_sizerust-analyzer cargo tiff 0.11.3 decoder/image/impl#[Image]readout_for_size().(width, height)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 1230 |
.to_plane_layoutrust-analyzer cargo tiff 0.11.3 decoder/image/impl#[ReadoutLayout]to_plane_layout().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1231 |
|
| 1232 |
if code_unit.0rust-analyzer cargo tiff 0.11.3 decoder/TiffCodingUnit#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]ge().layout.readoutrust-analyzer cargo tiff 0.11.3 decoder/image/PlaneLayout#readout..chunks_per_planerust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#chunks_per_plane. { |
| 1233 |
return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(TiffErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#::UsageErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#UsageError#(UsageErrorrust-analyzer cargo tiff 0.11.3 error/UsageError#::InvalidCodingUnitrust-analyzer cargo tiff 0.11.3 error/UsageError#InvalidCodingUnit#( |
| 1234 |
code_unit.0rust-analyzer cargo tiff 0.11.3 decoder/TiffCodingUnit#0., |
| 1235 |
layout.readoutrust-analyzer cargo tiff 0.11.3 decoder/image/PlaneLayout#readout..chunks_per_planerust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#chunks_per_plane., |
| 1236 |
))); |
| 1237 |
} |
| 1238 |
|
| 1239 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(BufferLayoutPreferencerust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#::from_planesrust-analyzer cargo tiff 0.11.3 decoder/impl#[BufferLayoutPreference]from_planes().(&layout)) |
| 1240 |
} |
| 1241 |
|
| 1242 |
/// Read the specified chunk (at index `chunk_index`) and return the binary data as a Vector. |
| 1243 |
/// |
| 1244 |
/// Note that for planar images each chunk contains only one sample of the underlying data. |
| 1245 |
pub fn read_chunkrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_chunk().(&mut self, chunk_index: u32) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#> { |
| 1246 |
let (width, height) = self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().chunk_data_dimensionsrust-analyzer cargo tiff 0.11.3 decoder/image/impl#[Image]chunk_data_dimensions().(chunk_index)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1247 |
|
| 1248 |
let readout = self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().readout_for_sizerust-analyzer cargo tiff 0.11.3 decoder/image/impl#[Image]readout_for_size().(width, height)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1249 |
|
| 1250 |
let mut result = readout |
| 1251 |
.result_extent_for_planesrust-analyzer cargo tiff 0.11.3 decoder/impl#[`image::ReadoutLayout`]result_extent_for_planes().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#1)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 1252 |
.to_result_bufferrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingExtent]to_result_buffer().(&self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader..limitsrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#limits.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1253 |
|
| 1254 |
self.read_chunk_to_bytesrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_chunk_to_bytes().(result.as_bufferrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]as_buffer().(0).as_bytes_mutrust-analyzer cargo tiff 0.11.3 decoder/impl#[`DecodingBuffer<'a>`]as_bytes_mut().(), chunk_index, &readout)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1255 |
|
| 1256 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(result) |
| 1257 |
} |
| 1258 |
|
| 1259 |
/// Read the specified chunk (at index `chunk_index`) into an allocated buffer. |
| 1260 |
/// |
| 1261 |
/// Returns a [`TiffError::UsageError`] if the chunk is smaller than the size indicated with a |
| 1262 |
/// call to [`Self::image_chunk_buffer_layout`]. Note that the alignment may be arbitrary, but |
| 1263 |
/// an alignment smaller than the preferred alignment may perform worse. |
| 1264 |
/// |
| 1265 |
/// Note that for planar images each chunk contains only one sample of the underlying data. |
| 1266 |
pub fn read_chunk_bytesrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_chunk_bytes().(&mut self, chunk_index: u32, buffer: &mut [u8]) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> { |
| 1267 |
let (width, height) = self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().chunk_data_dimensionsrust-analyzer cargo tiff 0.11.3 decoder/image/impl#[Image]chunk_data_dimensions().(chunk_index)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1268 |
|
| 1269 |
let layout = self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().readout_for_sizerust-analyzer cargo tiff 0.11.3 decoder/image/impl#[Image]readout_for_size().(width, height)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1270 |
layout.assert_min_layoutrust-analyzer cargo tiff 0.11.3 decoder/impl#[`image::ReadoutLayout`]assert_min_layout().(buffer)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1271 |
|
| 1272 |
self.read_chunk_to_bytesrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_chunk_to_bytes().(buffer, chunk_index, &layout)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1273 |
|
| 1274 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 1275 |
} |
| 1276 |
|
| 1277 |
/// Read the specified chunk (at index `chunk_index`) into a provide buffer. |
| 1278 |
/// |
| 1279 |
/// It will re-allocate the buffer into the correct type and size, within the decoder's |
| 1280 |
/// configured limits, and then pass it to the underlying method. This is essentially a |
| 1281 |
/// type-safe wrapper around the raw [`Self::read_chunk_bytes`] method. |
| 1282 |
/// |
| 1283 |
/// Note that for planar images each chunk contains only one sample of the underlying data. |
| 1284 |
pub fn read_chunk_to_bufferrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_chunk_to_buffer().( |
| 1285 |
&mut self, |
| 1286 |
buffer: &mut DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#, |
| 1287 |
chunk_index: u32, |
| 1288 |
output_width: usize, |
| 1289 |
) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> { |
| 1290 |
let (width, height) = self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().chunk_data_dimensionsrust-analyzer cargo tiff 0.11.3 decoder/image/impl#[Image]chunk_data_dimensions().(chunk_index)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1291 |
|
| 1292 |
let mut layout = self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().readout_for_sizerust-analyzer cargo tiff 0.11.3 decoder/image/impl#[Image]readout_for_size().(width, height)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1293 |
layout.set_row_striderust-analyzer cargo tiff 0.11.3 decoder/image/impl#[ReadoutLayout]set_row_stride().(output_width)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1294 |
|
| 1295 |
let extent = layout.result_extent_for_planesrust-analyzer cargo tiff 0.11.3 decoder/impl#[`image::ReadoutLayout`]result_extent_for_planes().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#1)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1296 |
buffer.resize_to_extentrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]resize_to_extent().(extent, &self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader..limitsrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#limits.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1297 |
|
| 1298 |
self.read_chunk_to_bytesrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_chunk_to_bytes().(buffer.as_bufferrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]as_buffer().(0).as_bytes_mutrust-analyzer cargo tiff 0.11.3 decoder/impl#[`DecodingBuffer<'a>`]as_bytes_mut().(), chunk_index, &layout)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1299 |
|
| 1300 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 1301 |
} |
| 1302 |
|
| 1303 |
/// Read chunks corresponding to several planes of a region of pixels. |
| 1304 |
/// |
| 1305 |
/// For non planar images this is equivalent to [`Self::read_chunk_bytes`] as there is only one |
| 1306 |
/// plane in the image. For planar images the planes are stored consecutively into the output |
| 1307 |
/// buffer. Returns an error if not enough space for at least one plane is provided. Otherwise |
| 1308 |
/// reads all planes that can be stored completely in the provided output buffer. |
| 1309 |
/// |
| 1310 |
/// A region is a rectangular assortment of pixels in the image, depending on the chunk type |
| 1311 |
/// either strips or tiles. Borrowing terminology from JPEG we call the collection of all |
| 1312 |
/// chunks from all planes that encode samples from the same region a "coding unit". |
| 1313 |
/// |
| 1314 |
/// # Bugs |
| 1315 |
/// |
| 1316 |
/// Sub-sampled images are not yet supported properly. |
| 1317 |
pub fn read_coding_unit_bytesrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_coding_unit_bytes().( |
| 1318 |
&mut self, |
| 1319 |
slice: TiffCodingUnitrust-analyzer cargo tiff 0.11.3 decoder/TiffCodingUnit#, |
| 1320 |
buffer: &mut [u8], |
| 1321 |
) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> { |
| 1322 |
let (width, height) = self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().chunk_data_dimensionsrust-analyzer cargo tiff 0.11.3 decoder/image/impl#[Image]chunk_data_dimensions().(slice.0rust-analyzer cargo tiff 0.11.3 decoder/TiffCodingUnit#0.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1323 |
let readout = self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().readout_for_sizerust-analyzer cargo tiff 0.11.3 decoder/image/impl#[Image]readout_for_size().(width, height)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1324 |
|
| 1325 |
let ref layout @ imagerust-analyzer cargo tiff 0.11.3 decoder/image/::PlaneLayoutrust-analyzer cargo tiff 0.11.3 decoder/image/PlaneLayout# { |
| 1326 |
ref plane_offsetsrust-analyzer cargo tiff 0.11.3 decoder/image/PlaneLayout#plane_offsets., |
| 1327 |
// We assume that is correct, so really it can be ignored. |
| 1328 |
total_bytesrust-analyzer cargo tiff 0.11.3 decoder/image/PlaneLayout#total_bytes.: _, |
| 1329 |
ref readoutrust-analyzer cargo tiff 0.11.3 decoder/image/PlaneLayout#readout., |
| 1330 |
} = readout.to_plane_layoutrust-analyzer cargo tiff 0.11.3 decoder/image/impl#[ReadoutLayout]to_plane_layout().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1331 |
|
| 1332 |
if slice.0rust-analyzer cargo tiff 0.11.3 decoder/TiffCodingUnit#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]ge().readout.chunks_per_planerust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#chunks_per_plane. { |
| 1333 |
return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(TiffErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#::UsageErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#UsageError#(UsageErrorrust-analyzer cargo tiff 0.11.3 error/UsageError#::InvalidCodingUnitrust-analyzer cargo tiff 0.11.3 error/UsageError#InvalidCodingUnit#( |
| 1334 |
slice.0rust-analyzer cargo tiff 0.11.3 decoder/TiffCodingUnit#0., |
| 1335 |
readout.chunks_per_planerust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#chunks_per_plane., |
| 1336 |
))); |
| 1337 |
} |
| 1338 |
|
| 1339 |
// No subsamples planes support, for now. |
| 1340 |
let used_plane_offsets = usize::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[usize][`From<u16>`]from().(layout.used_planesrust-analyzer cargo tiff 0.11.3 decoder/image/impl#[PlaneLayout]used_planes().(buffer)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().); |
| 1341 |
debug_assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert!!(used_plane_offsets >= 1, "Should have errored"); |
| 1342 |
|
| 1343 |
for (idx, &plane_offset) in plane_offsets[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#used_plane_offsets]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() { |
| 1344 |
let chunk = slice.0rust-analyzer cargo tiff 0.11.3 decoder/TiffCodingUnit#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().idx as u32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().readout.chunks_per_planerust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#chunks_per_plane.; |
| 1345 |
self.goto_offset_u64rust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]goto_offset_u64().(self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().chunk_offsetsrust-analyzer cargo tiff 0.11.3 decoder/image/Image#chunk_offsets.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().chunk as usize]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 result/impl#[`Result<T, E>`][Try]branch().; |
| 1346 |
|
| 1347 |
self.imagerust-analyzer cargo tiff 0.11.3 decoder/Decoder#image..expand_chunkrust-analyzer cargo tiff 0.11.3 decoder/image/impl#[Image]expand_chunk().( |
| 1348 |
&mut self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader., |
| 1349 |
&mut buffer[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().plane_offset..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut()., |
| 1350 |
readout, |
| 1351 |
chunk, |
| 1352 |
)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1353 |
} |
| 1354 |
|
| 1355 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 1356 |
} |
| 1357 |
|
| 1358 |
/// Returns the default chunk size for the current image. Any given chunk in the image is at most as large as |
| 1359 |
/// the value returned here. For the size of the data (chunk minus padding), use `chunk_data_dimensions`. |
| 1360 |
pub fn chunk_dimensionsrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]chunk_dimensions().(&self) -> (u32, u32) { |
| 1361 |
self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().chunk_dimensionsrust-analyzer cargo tiff 0.11.3 decoder/image/impl#[Image]chunk_dimensions().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().() |
| 1362 |
} |
| 1363 |
|
| 1364 |
/// Returns the size of the data in the chunk with the specified index. This is the default size of the chunk, |
| 1365 |
/// minus any padding. |
| 1366 |
pub fn chunk_data_dimensionsrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]chunk_data_dimensions().(&self, chunk_index: u32) -> (u32, u32) { |
| 1367 |
self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().() |
| 1368 |
.chunk_data_dimensionsrust-analyzer cargo tiff 0.11.3 decoder/image/impl#[Image]chunk_data_dimensions().(chunk_index) |
| 1369 |
.expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("invalid chunk_index") |
| 1370 |
} |
| 1371 |
|
| 1372 |
/// Returns the preferred buffer required to read the whole image with [`Self::read_image_bytes`]. |
| 1373 |
/// |
| 1374 |
/// Returns the layout without being specific as to the underlying type for forward |
| 1375 |
/// compatibility. Note that, in general, a TIFF may contain an almost arbitrary number of |
| 1376 |
/// channels of individual *bit* length and format each. |
| 1377 |
/// |
| 1378 |
/// See [`Self::colortype`] to describe the sample types. |
| 1379 |
/// |
| 1380 |
/// # Bugs |
| 1381 |
/// |
| 1382 |
/// When the image is stored as a planar configuration, this method will currently only |
| 1383 |
/// indicate the layout needed to read the first data plane. This will be fixed in a future |
| 1384 |
/// major version of `tiff`. |
| 1385 |
pub fn image_buffer_layoutrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image_buffer_layout().(&mut self) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<BufferLayoutPreferencerust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#> { |
| 1386 |
let layout = self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().readout_for_imagerust-analyzer cargo tiff 0.11.3 decoder/image/impl#[Image]readout_for_image().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..to_plane_layoutrust-analyzer cargo tiff 0.11.3 decoder/image/impl#[ReadoutLayout]to_plane_layout().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1387 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(BufferLayoutPreferencerust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#::from_planesrust-analyzer cargo tiff 0.11.3 decoder/impl#[BufferLayoutPreference]from_planes().(&layout)) |
| 1388 |
} |
| 1389 |
|
| 1390 |
/// Decodes the entire image and return it as a Vector |
| 1391 |
/// |
| 1392 |
/// # Examples |
| 1393 |
/// |
| 1394 |
/// This method is deprecated. For replacement usage see `examples/decode.rs`. |
| 1395 |
/// |
| 1396 |
/// # Bugs |
| 1397 |
/// |
| 1398 |
/// When the image is stored as a planar configuration, this method will currently only read |
| 1399 |
/// the first sample's plane. This will be fixed in a future major version of `tiff`. To read |
| 1400 |
/// multiple planes, [`Self::read_image_to_buffer`] can be used instead. |
| 1401 |
/// |
| 1402 |
/// # Intent to deprecate |
| 1403 |
/// |
| 1404 |
/// Use [`Self::read_image_to_buffer`] or a combination of [`DecodingResult::resize_to`] and |
| 1405 |
/// [`Self::read_image_bytes`] instead where possible, preserving the buffer across multiple |
| 1406 |
/// calls. This old method will likely keep its bugged planar behavior until it is fully |
| 1407 |
/// replaced, to ensure that existing code will not run into unexpectedly large allocations |
| 1408 |
/// that will error on limits instead. |
| 1409 |
pub fn read_imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_image().(&mut self) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#> { |
| 1410 |
let readout = self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().readout_for_imagerust-analyzer cargo tiff 0.11.3 decoder/image/impl#[Image]readout_for_image().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1411 |
|
| 1412 |
let mut result = readout |
| 1413 |
.result_extent_for_planesrust-analyzer cargo tiff 0.11.3 decoder/impl#[`image::ReadoutLayout`]result_extent_for_planes().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#1)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 1414 |
.to_result_bufferrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingExtent]to_result_buffer().(&self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader..limitsrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#limits.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1415 |
|
| 1416 |
self.read_image_bytesrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_image_bytes().(result.as_bufferrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]as_buffer().(0).as_bytes_mutrust-analyzer cargo tiff 0.11.3 decoder/impl#[`DecodingBuffer<'a>`]as_bytes_mut().())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1417 |
|
| 1418 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(result) |
| 1419 |
} |
| 1420 |
|
| 1421 |
/// Decodes the entire image into a provided buffer. |
| 1422 |
/// |
| 1423 |
/// It will re-allocate the buffer into the correct type and size, within the decoder's |
| 1424 |
/// configured limits, and then pass it to the underlying method. This is essentially a |
| 1425 |
/// type-safe wrapper around the raw [`Self::read_image_bytes`] method. |
| 1426 |
/// |
| 1427 |
/// ## Planar behavior |
| 1428 |
/// |
| 1429 |
/// If the image is stored as a planar configuration, an attempt is made to resize the buffer |
| 1430 |
/// to hold all planes. If that does not fit then only the first plane is read. Check the |
| 1431 |
/// buffer size against [`BufferLayoutPreference::complete_len`] to ensure that all planes were |
| 1432 |
/// read: |
| 1433 |
/// |
| 1434 |
/// ``` |
| 1435 |
/// use tiff::decoder::{Decoder, DecodingResult}; |
| 1436 |
/// let mut result = DecodingResult::U8(vec![]); |
| 1437 |
/// |
| 1438 |
/// let mut reader = /* */ |
| 1439 |
/// # Decoder::new(std::io::Cursor::new(include_bytes!(concat!( |
| 1440 |
/// # env!("CARGO_MANIFEST_DIR"), "/tests/images/tiled-gray-i1.tif" |
| 1441 |
/// # )))).unwrap(); |
| 1442 |
/// let layout = reader.read_image_to_buffer(&mut result)?; |
| 1443 |
/// |
| 1444 |
/// if result.as_buffer(0).as_bytes().len() < layout.complete_len { |
| 1445 |
/// println!("Only the first plane was read"); |
| 1446 |
/// } |
| 1447 |
/// |
| 1448 |
/// # Ok::<_, tiff::TiffError>(()) |
| 1449 |
/// ``` |
| 1450 |
/// |
| 1451 |
/// # Examples |
| 1452 |
/// |
| 1453 |
/// ``` |
| 1454 |
/// use tiff::decoder::{Decoder, DecodingResult, Limits}; |
| 1455 |
/// |
| 1456 |
/// let mut result = DecodingResult::I8(vec![]); |
| 1457 |
/// |
| 1458 |
/// let mut reader = /* */ |
| 1459 |
/// # Decoder::new(std::io::Cursor::new(include_bytes!(concat!( |
| 1460 |
/// # env!("CARGO_MANIFEST_DIR"), "/tests/images/tiled-gray-i1.tif" |
| 1461 |
/// # )))).unwrap(); |
| 1462 |
/// |
| 1463 |
/// reader.read_image_to_buffer(&mut result)?; |
| 1464 |
/// |
| 1465 |
/// # Ok::<_, tiff::TiffError>(()) |
| 1466 |
/// ``` |
| 1467 |
pub fn read_image_to_bufferrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_image_to_buffer().( |
| 1468 |
&mut self, |
| 1469 |
result: &mut DecodingResultrust-analyzer cargo tiff 0.11.3 decoder/DecodingResult#, |
| 1470 |
) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<BufferLayoutPreferencerust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#> { |
| 1471 |
let readout = self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().readout_for_imagerust-analyzer cargo tiff 0.11.3 decoder/image/impl#[Image]readout_for_image().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1472 |
let planes = readout.to_plane_layoutrust-analyzer cargo tiff 0.11.3 decoder/image/impl#[ReadoutLayout]to_plane_layout().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1473 |
|
| 1474 |
let num_planes = if planes.total_bytesrust-analyzer cargo tiff 0.11.3 decoder/image/PlaneLayout#total_bytes. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader..limitsrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#limits..decoding_buffer_sizerust-analyzer cargo tiff 0.11.3 decoder/Limits#decoding_buffer_size. { |
| 1475 |
planes.plane_offsetsrust-analyzer cargo tiff 0.11.3 decoder/image/PlaneLayout#plane_offsets..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() as u16 |
| 1476 |
} else { |
| 1477 |
1 |
| 1478 |
}; |
| 1479 |
|
| 1480 |
let layout = BufferLayoutPreferencerust-analyzer cargo tiff 0.11.3 decoder/BufferLayoutPreference#::from_planesrust-analyzer cargo tiff 0.11.3 decoder/impl#[BufferLayoutPreference]from_planes().(&planes); |
| 1481 |
let extent = readout.result_extent_for_planesrust-analyzer cargo tiff 0.11.3 decoder/impl#[`image::ReadoutLayout`]result_extent_for_planes().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#num_planes)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1482 |
// Compatibility: if this extent is too large our configured limits we will fall back to |
| 1483 |
// reading only the first plane. |
| 1484 |
result.resize_to_extentrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]resize_to_extent().(extent, &self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader..limitsrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#limits.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1485 |
|
| 1486 |
self.read_image_bytesrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_image_bytes().(result.as_bufferrust-analyzer cargo tiff 0.11.3 decoder/impl#[DecodingResult]as_buffer().(0).as_bytes_mutrust-analyzer cargo tiff 0.11.3 decoder/impl#[`DecodingBuffer<'a>`]as_bytes_mut().())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1487 |
|
| 1488 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(layout) |
| 1489 |
} |
| 1490 |
|
| 1491 |
/// Decodes the entire image into a provided buffer. |
| 1492 |
/// |
| 1493 |
/// Returns a [`TiffError::UsageError`] if the chunk is smaller than the size indicated with a |
| 1494 |
/// call to [`Self::image_buffer_layout`]. Note that the alignment may be arbitrary, but an |
| 1495 |
/// alignment smaller than the preferred alignment may perform worse. |
| 1496 |
/// |
| 1497 |
/// # Error |
| 1498 |
/// |
| 1499 |
/// Returns an error if the buffer fits less than one plane. In particular, for non-planar |
| 1500 |
/// images returns an error if the buffer does not fit the required size. |
| 1501 |
pub fn read_image_bytesrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_image_bytes().(&mut self, buffer: &mut [u8]) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<()> { |
| 1502 |
let readout = self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().readout_for_imagerust-analyzer cargo tiff 0.11.3 decoder/image/impl#[Image]readout_for_image().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1503 |
|
| 1504 |
let ref layout @ imagerust-analyzer cargo tiff 0.11.3 decoder/image/::PlaneLayoutrust-analyzer cargo tiff 0.11.3 decoder/image/PlaneLayout# { |
| 1505 |
ref plane_offsetsrust-analyzer cargo tiff 0.11.3 decoder/image/PlaneLayout#plane_offsets., |
| 1506 |
// We assume that is correct, so really it can be ignored. |
| 1507 |
total_bytesrust-analyzer cargo tiff 0.11.3 decoder/image/PlaneLayout#total_bytes.: _, |
| 1508 |
ref readoutrust-analyzer cargo tiff 0.11.3 decoder/image/PlaneLayout#readout., |
| 1509 |
} = readout.to_plane_layoutrust-analyzer cargo tiff 0.11.3 decoder/image/impl#[ReadoutLayout]to_plane_layout().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1510 |
|
| 1511 |
let used_plane_offsets = usize::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[usize][`From<u16>`]from().(layout.used_planesrust-analyzer cargo tiff 0.11.3 decoder/image/impl#[PlaneLayout]used_planes().(buffer)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().); |
| 1512 |
debug_assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert!!(used_plane_offsets >= 1, "Should have errored"); |
| 1513 |
|
| 1514 |
// For multi-band images, only the first band is read. |
| 1515 |
// Possible improvements: |
| 1516 |
// * pass requested band as parameter |
| 1517 |
// * collect bands to a RGB encoding result in case of RGB bands |
| 1518 |
for chunk in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#readout.chunks_per_planerust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#chunks_per_plane. { |
| 1519 |
let x = (chunk rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().readout.chunks_acrossrust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#chunks_across.) as usize; |
| 1520 |
let y = (chunk rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div().readout.chunks_acrossrust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#chunks_across.) as usize; |
| 1521 |
|
| 1522 |
let buffer_offset = y 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().readout.chunk_col_striderust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#chunk_col_stride. 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().x 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().readout.chunk_row_striderust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#chunk_row_stride.; |
| 1523 |
|
| 1524 |
for (idx, &plane_offset) in plane_offsets[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#used_plane_offsets]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() { |
| 1525 |
let chunk = chunk rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().idx as u32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().readout.chunks_per_planerust-analyzer cargo tiff 0.11.3 decoder/image/ReadoutLayout#chunks_per_plane.; |
| 1526 |
self.goto_offset_u64rust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]goto_offset_u64().(self.imagerust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image().().chunk_offsetsrust-analyzer cargo tiff 0.11.3 decoder/image/Image#chunk_offsets.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().chunk as usize]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 result/impl#[`Result<T, E>`][Try]branch().; |
| 1527 |
|
| 1528 |
self.imagerust-analyzer cargo tiff 0.11.3 decoder/Decoder#image..expand_chunkrust-analyzer cargo tiff 0.11.3 decoder/image/impl#[Image]expand_chunk().( |
| 1529 |
&mut self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader., |
| 1530 |
&mut buffer[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().plane_offset..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut().buffer_offset..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut()., |
| 1531 |
readout, |
| 1532 |
chunk, |
| 1533 |
)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1534 |
} |
| 1535 |
} |
| 1536 |
|
| 1537 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 1538 |
} |
| 1539 |
|
| 1540 |
/// Get the IFD decoder for our current image IFD. |
| 1541 |
pub fn image_ifdrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image_ifd().(&mut self) -> IfdDecoderrust-analyzer cargo tiff 0.11.3 decoder/IfdDecoder#<'_> { |
| 1542 |
IfdDecoderrust-analyzer cargo tiff 0.11.3 decoder/IfdDecoder# { |
| 1543 |
innerrust-analyzer cargo tiff 0.11.3 decoder/IfdDecoder#inner.: tag_readerrust-analyzer cargo tiff 0.11.3 decoder/tag_reader/::TagReaderrust-analyzer cargo tiff 0.11.3 decoder/tag_reader/TagReader# { |
| 1544 |
decoderrust-analyzer cargo tiff 0.11.3 decoder/tag_reader/TagReader#decoder.: &mut self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader., |
| 1545 |
ifdrust-analyzer cargo tiff 0.11.3 decoder/tag_reader/TagReader#ifd.: self.imagerust-analyzer cargo tiff 0.11.3 decoder/Decoder#image..ifdrust-analyzer cargo tiff 0.11.3 decoder/image/Image#ifd..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 1546 |
}, |
| 1547 |
} |
| 1548 |
} |
| 1549 |
|
| 1550 |
/// Prepare reading values for tags of a given directory. |
| 1551 |
/// |
| 1552 |
/// # Examples |
| 1553 |
/// |
| 1554 |
/// This method may be used to read the values of tags in directories that have been previously |
| 1555 |
/// read with [`Decoder::read_directory`]. |
| 1556 |
/// |
| 1557 |
/// ```no_run |
| 1558 |
/// use tiff::decoder::Decoder; |
| 1559 |
/// use tiff::tags::Tag; |
| 1560 |
/// |
| 1561 |
/// # use std::io::Cursor; |
| 1562 |
/// # let mut data = Cursor::new(vec![0]); |
| 1563 |
/// let mut decoder = Decoder::new(&mut data).unwrap(); |
| 1564 |
/// let sub_ifds = decoder.get_tag(Tag::SubIfd)?.into_ifd_vec()?; |
| 1565 |
/// |
| 1566 |
/// for ifd in sub_ifds { |
| 1567 |
/// let subdir = decoder.read_directory(ifd)?; |
| 1568 |
/// let subfile = decoder.read_directory_tags(&subdir).find_tag(Tag::SubfileType)?; |
| 1569 |
/// // omitted: handle the subfiles, e.g. thumbnails |
| 1570 |
/// } |
| 1571 |
/// |
| 1572 |
/// # Ok::<_, tiff::TiffError>(()) |
| 1573 |
/// ``` |
| 1574 |
pub fn read_directory_tagsrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]read_directory_tags().<'ifd>(&'ifd mut self, ifd: &'ifd Directoryrust-analyzer cargo tiff 0.11.3 directory/Directory#) -> IfdDecoderrust-analyzer cargo tiff 0.11.3 decoder/IfdDecoder#<'ifd> { |
| 1575 |
IfdDecoderrust-analyzer cargo tiff 0.11.3 decoder/IfdDecoder# { |
| 1576 |
innerrust-analyzer cargo tiff 0.11.3 decoder/IfdDecoder#inner.: tag_readerrust-analyzer cargo tiff 0.11.3 decoder/tag_reader/::TagReaderrust-analyzer cargo tiff 0.11.3 decoder/tag_reader/TagReader# { |
| 1577 |
decoderrust-analyzer cargo tiff 0.11.3 decoder/tag_reader/TagReader#decoder.: &mut self.value_readerrust-analyzer cargo tiff 0.11.3 decoder/Decoder#value_reader., |
| 1578 |
ifdrust-analyzer cargo tiff 0.11.3 decoder/tag_reader/TagReader#ifd., |
| 1579 |
}, |
| 1580 |
} |
| 1581 |
} |
| 1582 |
|
| 1583 |
/// Tries to retrieve a tag from the current image directory. |
| 1584 |
/// Return `Ok(None)` if the tag is not present. |
| 1585 |
pub fn find_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]find_tag().(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#>> { |
| 1586 |
self.image_ifdrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image_ifd().().find_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]find_tag().(tag) |
| 1587 |
} |
| 1588 |
|
| 1589 |
/// Tries to retrieve a tag in the current image directory and convert it to the desired |
| 1590 |
/// unsigned type. |
| 1591 |
pub fn find_tag_unsignedrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]find_tag_unsigned().<T: TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<u64>>(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<T>> { |
| 1592 |
self.image_ifdrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image_ifd().().find_tag_unsignedrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]find_tag_unsigned().(tag) |
| 1593 |
} |
| 1594 |
|
| 1595 |
/// Tries to retrieve a vector of all a tag's values and convert them to the desired unsigned |
| 1596 |
/// type. |
| 1597 |
pub fn find_tag_unsigned_vecrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]find_tag_unsigned_vec().<T: TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<u64>>( |
| 1598 |
&mut self, |
| 1599 |
tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#, |
| 1600 |
) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<T>>> { |
| 1601 |
self.image_ifdrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image_ifd().().find_tag_unsigned_vecrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]find_tag_unsigned_vec().(tag) |
| 1602 |
} |
| 1603 |
|
| 1604 |
/// Tries to retrieve a tag from the current image directory and convert it to the desired |
| 1605 |
/// unsigned type. Returns an error if the tag is not present. |
| 1606 |
pub fn get_tag_unsignedrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag_unsigned().<T: TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<u64>>(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<T> { |
| 1607 |
self.image_ifdrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image_ifd().().get_tag_unsignedrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]get_tag_unsigned().(tag) |
| 1608 |
} |
| 1609 |
|
| 1610 |
/// Tries to retrieve a tag from the current image directory. |
| 1611 |
/// Returns an error if the tag is not present |
| 1612 |
pub fn get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag().(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#> { |
| 1613 |
self.image_ifdrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image_ifd().().get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]get_tag().(tag) |
| 1614 |
} |
| 1615 |
|
| 1616 |
pub fn get_tag_u32rust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag_u32().(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<u32> { |
| 1617 |
self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..into_u32rust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_u32().() |
| 1618 |
} |
| 1619 |
|
| 1620 |
pub fn get_tag_u64rust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag_u64().(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<u64> { |
| 1621 |
self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..into_u64rust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_u64().() |
| 1622 |
} |
| 1623 |
|
| 1624 |
/// Tries to retrieve a tag and convert it to the desired type. |
| 1625 |
pub fn get_tag_f32rust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag_f32().(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<f32> { |
| 1626 |
self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..into_f32rust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_f32().() |
| 1627 |
} |
| 1628 |
|
| 1629 |
/// Tries to retrieve a tag and convert it to the desired type. |
| 1630 |
pub fn get_tag_f64rust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag_f64().(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<f64> { |
| 1631 |
self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..into_f64rust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_f64().() |
| 1632 |
} |
| 1633 |
|
| 1634 |
/// Tries to retrieve a tag and convert it to the desired type. |
| 1635 |
pub fn get_tag_u32_vecrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag_u32_vec().(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u32>> { |
| 1636 |
self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..into_u32_vecrust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_u32_vec().() |
| 1637 |
} |
| 1638 |
|
| 1639 |
pub fn get_tag_u16_vecrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag_u16_vec().(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u16>> { |
| 1640 |
self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..into_u16_vecrust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_u16_vec().() |
| 1641 |
} |
| 1642 |
|
| 1643 |
pub fn get_tag_u64_vecrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag_u64_vec().(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u64>> { |
| 1644 |
self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..into_u64_vecrust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_u64_vec().() |
| 1645 |
} |
| 1646 |
|
| 1647 |
/// Tries to retrieve a tag and convert it to the desired type. |
| 1648 |
pub fn get_tag_f32_vecrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag_f32_vec().(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<f32>> { |
| 1649 |
self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..into_f32_vecrust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_f32_vec().() |
| 1650 |
} |
| 1651 |
|
| 1652 |
/// Tries to retrieve a tag and convert it to the desired type. |
| 1653 |
pub fn get_tag_f64_vecrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag_f64_vec().(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<f64>> { |
| 1654 |
self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..into_f64_vecrust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_f64_vec().() |
| 1655 |
} |
| 1656 |
|
| 1657 |
/// Tries to retrieve a tag and convert it to a 8bit vector. |
| 1658 |
pub fn get_tag_u8_vecrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag_u8_vec().(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>> { |
| 1659 |
self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..into_u8_vecrust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_u8_vec().() |
| 1660 |
} |
| 1661 |
|
| 1662 |
/// Tries to retrieve a tag and convert it to a ascii vector. |
| 1663 |
pub fn get_tag_ascii_stringrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag_ascii_string().(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> { |
| 1664 |
self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]get_tag().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..into_stringrust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_string().() |
| 1665 |
} |
| 1666 |
|
| 1667 |
pub fn tag_iterrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]tag_iter().(&mut self) -> impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#)>> + '_ { |
| 1668 |
self.image_ifdrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image_ifd().().tag_iterrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'l>`]tag_iter().() |
| 1669 |
} |
| 1670 |
} |
| 1671 |
|
| 1672 |
impl<R: Seekrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Seek# + Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#> ValueReaderrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#<R> { |
| 1673 |
pub(craterust-analyzer cargo tiff 0.11.3 crate/) fn read_directoryrust-analyzer cargo tiff 0.11.3 decoder/impl#[`ValueReader<R>`]read_directory().(&mut self, ptr: IfdPointerrust-analyzer cargo tiff 0.11.3 tags/IfdPointer#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Directoryrust-analyzer cargo tiff 0.11.3 directory/Directory#, TiffErrorrust-analyzer cargo tiff 0.11.3 error/TiffError#> { |
| 1674 |
Selfrust-analyzer cargo tiff 0.11.3 decoder/impl#[`ValueReader<R>`]::read_ifdrust-analyzer cargo tiff 0.11.3 decoder/impl#[`ValueReader<R>`]read_ifd().(&mut self.readerrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#reader., self.bigtiffrust-analyzer cargo tiff 0.11.3 decoder/ValueReader#bigtiff., ptr) |
| 1675 |
} |
| 1676 |
|
| 1677 |
/// Reads a IFD entry. |
| 1678 |
// An IFD entry has four fields: |
| 1679 |
// |
| 1680 |
// Tag 2 bytes |
| 1681 |
// Type 2 bytes |
| 1682 |
// Count 4 bytes |
| 1683 |
// Value 4 bytes either a pointer the value itself |
| 1684 |
fn read_entryrust-analyzer cargo tiff 0.11.3 decoder/impl#[`ValueReader<R>`]read_entry().( |
| 1685 |
reader: &mut EndianReaderrust-analyzer cargo tiff 0.11.3 decoder/stream/EndianReader#<R>, |
| 1686 |
bigtiff: bool, |
| 1687 |
) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Entryrust-analyzer cargo tiff 0.11.3 decoder/ifd/Entry#)>> { |
| 1688 |
let tag = Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::from_u16_exhaustiverust-analyzer cargo tiff 0.11.3 tags/impl#[Tag]from_u16_exhaustive().(reader.read_u16rust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]read_u16().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().); |
| 1689 |
let type_ = match Typerust-analyzer cargo tiff 0.11.3 tags/Type#::from_u16rust-analyzer cargo tiff 0.11.3 tags/impl#[Type]from_u16().(reader.read_u16rust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]read_u16().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().) { |
| 1690 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(t) => t, |
| 1691 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => { |
| 1692 |
// Unknown type. Skip this entry according to spec. |
| 1693 |
reader.read_u32rust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]read_u32().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1694 |
reader.read_u32rust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]read_u32().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1695 |
return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1696 |
} |
| 1697 |
}; |
| 1698 |
let entry = if bigtiff { |
| 1699 |
let mut offset = [0; 8]; |
| 1700 |
|
| 1701 |
let count = reader.read_u64rust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]read_u64().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1702 |
reader.innerrust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]inner().().read_exactrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#read_exact().(&mut offset)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1703 |
ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Entryrust-analyzer cargo tiff 0.11.3 decoder/ifd/Entry#::new_u64rust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Entry]new_u64().(type_, count, offset) |
| 1704 |
} else { |
| 1705 |
let mut offset = [0; 4]; |
| 1706 |
|
| 1707 |
let count = reader.read_u32rust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]read_u32().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1708 |
reader.innerrust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]inner().().read_exactrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#read_exact().(&mut offset)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1709 |
ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Entryrust-analyzer cargo tiff 0.11.3 decoder/ifd/Entry#::newrust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Entry]new().(type_, count, offset) |
| 1710 |
}; |
| 1711 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((tag, entry))) |
| 1712 |
} |
| 1713 |
|
| 1714 |
/// Reads the IFD starting at the indicated location. |
| 1715 |
fn read_ifdrust-analyzer cargo tiff 0.11.3 decoder/impl#[`ValueReader<R>`]read_ifd().( |
| 1716 |
reader: &mut EndianReaderrust-analyzer cargo tiff 0.11.3 decoder/stream/EndianReader#<R>, |
| 1717 |
bigtiff: bool, |
| 1718 |
ifd_location: IfdPointerrust-analyzer cargo tiff 0.11.3 tags/IfdPointer#, |
| 1719 |
) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Directoryrust-analyzer cargo tiff 0.11.3 directory/Directory#> { |
| 1720 |
reader.goto_offsetrust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]goto_offset().(ifd_location.0rust-analyzer cargo tiff 0.11.3 tags/IfdPointer#0.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1721 |
|
| 1722 |
let mut entries: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<_, _> = BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V>`]new().(); |
| 1723 |
|
| 1724 |
let num_tags = if bigtiff { |
| 1725 |
reader.read_u64rust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]read_u64().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 1726 |
} else { |
| 1727 |
reader.read_u16rust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]read_u16().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 1728 |
}; |
| 1729 |
|
| 1730 |
for _ in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#num_tags { |
| 1731 |
let (tag, entry) = match Selfrust-analyzer cargo tiff 0.11.3 decoder/impl#[`ValueReader<R>`]::read_entryrust-analyzer cargo tiff 0.11.3 decoder/impl#[`ValueReader<R>`]read_entry().(reader, bigtiff)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). { |
| 1732 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(val) => val, |
| 1733 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => { |
| 1734 |
continue; |
| 1735 |
} // Unknown data type in tag, skip |
| 1736 |
}; |
| 1737 |
|
| 1738 |
entries.insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]insert().(tag.to_u16rust-analyzer cargo tiff 0.11.3 tags/impl#[Tag]to_u16().(), entry); |
| 1739 |
} |
| 1740 |
|
| 1741 |
let next_ifd = if bigtiff { |
| 1742 |
reader.read_u64rust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]read_u64().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 1743 |
} else { |
| 1744 |
reader.read_u32rust-analyzer cargo tiff 0.11.3 decoder/stream/impl#[`EndianReader<R>`]read_u32().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 1745 |
}; |
| 1746 |
|
| 1747 |
let next_ifd = corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::numrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/::NonZeroU64rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU64#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/impl#[`NonZero<T>`]new().(next_ifd); |
| 1748 |
|
| 1749 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Directoryrust-analyzer cargo tiff 0.11.3 directory/Directory# { entriesrust-analyzer cargo tiff 0.11.3 directory/Directory#entries., next_ifdrust-analyzer cargo tiff 0.11.3 directory/Directory#next_ifd. }) |
| 1750 |
} |
| 1751 |
} |
| 1752 |
|
| 1753 |
impl IfdDecoderrust-analyzer cargo tiff 0.11.3 decoder/IfdDecoder#<'_> { |
| 1754 |
/// Retrieve the IFD entry for a given tag, if it exists. |
| 1755 |
/// |
| 1756 |
/// The entry contains the metadata of the value, that is its type and count from which we can |
| 1757 |
/// calculate a total byte size. |
| 1758 |
pub fn find_entryrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]find_entry().(&self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Entryrust-analyzer cargo tiff 0.11.3 decoder/ifd/Entry#> { |
| 1759 |
self.innerrust-analyzer cargo tiff 0.11.3 decoder/IfdDecoder#inner..ifdrust-analyzer cargo tiff 0.11.3 decoder/tag_reader/TagReader#ifd..getrust-analyzer cargo tiff 0.11.3 directory/impl#[Directory]get().(tag).clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<&T>`]cloned().() |
| 1760 |
} |
| 1761 |
|
| 1762 |
/// Tries to retrieve a tag. |
| 1763 |
/// Return `Ok(None)` if the tag is not present. |
| 1764 |
pub fn find_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]find_tag().(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#>> { |
| 1765 |
self.innerrust-analyzer cargo tiff 0.11.3 decoder/IfdDecoder#inner..find_tagrust-analyzer cargo tiff 0.11.3 decoder/tag_reader/impl#[`TagReader<'a, R>`]find_tag().(tag) |
| 1766 |
} |
| 1767 |
|
| 1768 |
/// Retrieve a tag and reproduce its bytes into the provided buffer. |
| 1769 |
/// |
| 1770 |
/// The buffer is unmodified if the tag is not present. |
| 1771 |
pub fn find_tag_bufrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]find_tag_buf().( |
| 1772 |
&mut self, |
| 1773 |
tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#, |
| 1774 |
buf: &mut ValueBufferrust-analyzer cargo tiff 0.11.3 tags/ValueBuffer#, |
| 1775 |
) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Entryrust-analyzer cargo tiff 0.11.3 decoder/ifd/Entry#>> { |
| 1776 |
self.innerrust-analyzer cargo tiff 0.11.3 decoder/IfdDecoder#inner..find_tag_bufrust-analyzer cargo tiff 0.11.3 decoder/tag_reader/impl#[`TagReader<'a, R>`]find_tag_buf().(tag, buf) |
| 1777 |
} |
| 1778 |
|
| 1779 |
/// Read bytes of a tag's value into a byte buffer. |
| 1780 |
pub fn find_tag_bytesrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]find_tag_bytes().( |
| 1781 |
&mut self, |
| 1782 |
tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#, |
| 1783 |
buf: &mut [u8], |
| 1784 |
offset: u64, |
| 1785 |
) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>> { |
| 1786 |
self.innerrust-analyzer cargo tiff 0.11.3 decoder/IfdDecoder#inner..find_tag_rawrust-analyzer cargo tiff 0.11.3 decoder/tag_reader/impl#[`TagReader<'a, R>`]find_tag_raw().(tag, buf, offset) |
| 1787 |
} |
| 1788 |
|
| 1789 |
/// Tries to retrieve a tag and convert it to the desired unsigned type. |
| 1790 |
pub fn find_tag_unsignedrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]find_tag_unsigned().<T: TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<u64>>(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<T>> { |
| 1791 |
self.find_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]find_tag().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 1792 |
.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|v| v.into_u64rust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_u64().()) |
| 1793 |
.transposerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<Result<T, E>>`]transpose().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 1794 |
.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|value| { |
| 1795 |
T::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#try_from().(value).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| TiffFormatErrorrust-analyzer cargo tiff 0.11.3 error/TiffFormatError#::InvalidTagValueTyperust-analyzer cargo tiff 0.11.3 error/TiffFormatError#InvalidTagValueType#(tag).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) |
| 1796 |
}) |
| 1797 |
.transposerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<Result<T, E>>`]transpose().() |
| 1798 |
} |
| 1799 |
|
| 1800 |
/// Tries to retrieve a vector of all a tag's values and convert them to |
| 1801 |
/// the desired unsigned type. |
| 1802 |
pub fn find_tag_unsigned_vecrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]find_tag_unsigned_vec().<T: TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<u64>>( |
| 1803 |
&mut self, |
| 1804 |
tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#, |
| 1805 |
) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<T>>> { |
| 1806 |
self.find_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]find_tag().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 1807 |
.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|v| v.into_u64_vecrust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_u64_vec().()) |
| 1808 |
.transposerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<Result<T, E>>`]transpose().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 1809 |
.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|v| { |
| 1810 |
v.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().() |
| 1811 |
.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|u| { |
| 1812 |
T::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#try_from().(u).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| TiffFormatErrorrust-analyzer cargo tiff 0.11.3 error/TiffFormatError#::InvalidTagValueTyperust-analyzer cargo tiff 0.11.3 error/TiffFormatError#InvalidTagValueType#(tag).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) |
| 1813 |
}) |
| 1814 |
.collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().() |
| 1815 |
}) |
| 1816 |
.transposerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<Result<T, E>>`]transpose().() |
| 1817 |
} |
| 1818 |
|
| 1819 |
/// Tries to retrieve a tag and convert it to the desired unsigned type. |
| 1820 |
/// Returns an error if the tag is not present. |
| 1821 |
pub fn get_tag_unsignedrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]get_tag_unsigned().<T: TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<u64>>(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<T> { |
| 1822 |
self.find_tag_unsignedrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]find_tag_unsigned().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 1823 |
.ok_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or_else().(|| TiffFormatErrorrust-analyzer cargo tiff 0.11.3 error/TiffFormatError#::RequiredTagNotFoundrust-analyzer cargo tiff 0.11.3 error/TiffFormatError#RequiredTagNotFound#(tag).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) |
| 1824 |
} |
| 1825 |
|
| 1826 |
/// Tries to retrieve a tag. |
| 1827 |
/// Returns an error if the tag is not present |
| 1828 |
pub fn get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]get_tag().(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#> { |
| 1829 |
match self.find_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]find_tag().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). { |
| 1830 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(val) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(val), |
| 1831 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => 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#( |
| 1832 |
TiffFormatErrorrust-analyzer cargo tiff 0.11.3 error/TiffFormatError#::RequiredTagNotFoundrust-analyzer cargo tiff 0.11.3 error/TiffFormatError#RequiredTagNotFound#(tag), |
| 1833 |
)), |
| 1834 |
} |
| 1835 |
} |
| 1836 |
|
| 1837 |
/// Tries to retrieve a tag and convert it to the desired type. |
| 1838 |
pub fn get_tag_u32rust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]get_tag_u32().(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<u32> { |
| 1839 |
self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]get_tag().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..into_u32rust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_u32().() |
| 1840 |
} |
| 1841 |
|
| 1842 |
pub fn get_tag_u64rust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]get_tag_u64().(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<u64> { |
| 1843 |
self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]get_tag().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..into_u64rust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_u64().() |
| 1844 |
} |
| 1845 |
|
| 1846 |
/// Tries to retrieve a tag and convert it to the desired type. |
| 1847 |
pub fn get_tag_f32rust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]get_tag_f32().(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<f32> { |
| 1848 |
self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]get_tag().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..into_f32rust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_f32().() |
| 1849 |
} |
| 1850 |
|
| 1851 |
/// Tries to retrieve a tag and convert it to the desired type. |
| 1852 |
pub fn get_tag_f64rust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]get_tag_f64().(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<f64> { |
| 1853 |
self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]get_tag().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..into_f64rust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_f64().() |
| 1854 |
} |
| 1855 |
|
| 1856 |
/// Tries to retrieve a tag and convert it to the desired type. |
| 1857 |
pub fn get_tag_u32_vecrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]get_tag_u32_vec().(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u32>> { |
| 1858 |
self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]get_tag().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..into_u32_vecrust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_u32_vec().() |
| 1859 |
} |
| 1860 |
|
| 1861 |
pub fn get_tag_u16_vecrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]get_tag_u16_vec().(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u16>> { |
| 1862 |
self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]get_tag().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..into_u16_vecrust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_u16_vec().() |
| 1863 |
} |
| 1864 |
|
| 1865 |
pub fn get_tag_u64_vecrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]get_tag_u64_vec().(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u64>> { |
| 1866 |
self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]get_tag().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..into_u64_vecrust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_u64_vec().() |
| 1867 |
} |
| 1868 |
|
| 1869 |
/// Tries to retrieve a tag and convert it to the desired type. |
| 1870 |
pub fn get_tag_f32_vecrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]get_tag_f32_vec().(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<f32>> { |
| 1871 |
self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]get_tag().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..into_f32_vecrust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_f32_vec().() |
| 1872 |
} |
| 1873 |
|
| 1874 |
/// Tries to retrieve a tag and convert it to the desired type. |
| 1875 |
pub fn get_tag_f64_vecrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]get_tag_f64_vec().(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<f64>> { |
| 1876 |
self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]get_tag().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..into_f64_vecrust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_f64_vec().() |
| 1877 |
} |
| 1878 |
|
| 1879 |
/// Tries to retrieve a tag and convert it to a 8bit vector. |
| 1880 |
pub fn get_tag_u8_vecrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]get_tag_u8_vec().(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>> { |
| 1881 |
self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]get_tag().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..into_u8_vecrust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_u8_vec().() |
| 1882 |
} |
| 1883 |
|
| 1884 |
/// Tries to retrieve a tag and convert it to a ascii vector. |
| 1885 |
pub fn get_tag_ascii_stringrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]get_tag_ascii_string().(&mut self, tag: Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#) -> TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> { |
| 1886 |
self.get_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]get_tag().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..into_stringrust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_string().() |
| 1887 |
} |
| 1888 |
|
| 1889 |
/// Inspect the raw underlying directory. |
| 1890 |
pub fn directoryrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]directory().(&self) -> &Directoryrust-analyzer cargo tiff 0.11.3 directory/Directory# { |
| 1891 |
self.innerrust-analyzer cargo tiff 0.11.3 decoder/IfdDecoder#inner..ifdrust-analyzer cargo tiff 0.11.3 decoder/tag_reader/TagReader#ifd. |
| 1892 |
} |
| 1893 |
} |
| 1894 |
|
| 1895 |
impl<'l> IfdDecoderrust-analyzer cargo tiff 0.11.3 decoder/IfdDecoder#<'l> { |
| 1896 |
/// Returns an iterator over all tags in the current image, along with their values. |
| 1897 |
pub fn tag_iterrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'l>`]tag_iter().(self) -> impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = TiffResultrust-analyzer cargo tiff 0.11.3 error/TiffResult#<(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#, ifdrust-analyzer cargo tiff 0.11.3 decoder/ifd/::Valuerust-analyzer cargo tiff 0.11.3 decoder/ifd/Value#)>> + 'l { |
| 1898 |
self.innerrust-analyzer cargo tiff 0.11.3 decoder/IfdDecoder#inner. |
| 1899 |
.ifdrust-analyzer cargo tiff 0.11.3 decoder/tag_reader/TagReader#ifd. |
| 1900 |
.iterrust-analyzer cargo tiff 0.11.3 directory/impl#[Directory]iter().() |
| 1901 |
.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(tag, entry)| match self.innerrust-analyzer cargo tiff 0.11.3 decoder/IfdDecoder#inner..decoderrust-analyzer cargo tiff 0.11.3 decoder/tag_reader/TagReader#decoder..entry_valrust-analyzer cargo tiff 0.11.3 decoder/tag_reader/EntryDecoder#entry_val().(entry) { |
| 1902 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(value) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((tag, value)), |
| 1903 |
Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err), |
| 1904 |
}) |
| 1905 |
} |
| 1906 |
} |
| 1907 |
|
| 1908 |
#[cfg(test)] |
| 1909 |
mod testsrust-analyzer cargo tiff 0.11.3 decoder/tests/ { |
| 1910 |
use superrust-analyzer cargo tiff 0.11.3 decoder/::Decoderrust-analyzer cargo tiff 0.11.3 decoder/Decoder#; |
| 1911 |
use craterust-analyzer cargo tiff 0.11.3 crate/::{ |
| 1912 |
bytecastrust-analyzer cargo tiff 0.11.3 bytecast/, |
| 1913 |
tagsrust-analyzer cargo tiff 0.11.3 tags/::{ByteOrderrust-analyzer cargo tiff 0.11.3 tags/ByteOrder#, Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#, ValueBufferrust-analyzer cargo tiff 0.11.3 tags/ValueBuffer#}, |
| 1914 |
}; |
| 1915 |
|
| 1916 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| •1917 |
#[ignore = "skipping, missing test data"] |
| 1918 |
fn equivalence_of_tag_readersrust-analyzer cargo tiff 0.11.3 decoder/tests/equivalence_of_tag_readers().() { |
| 1919 |
let file = 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#::openrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[File]open().(concatrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/concat!!( |
| 1920 |
envrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/env!!("CARGO_MANIFEST_DIR"), |
| 1921 |
"/tests/images/int8_rgb.tif" |
| 1922 |
)) |
| 1923 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 1924 |
|
| 1925 |
let mut decoder = Decoderrust-analyzer cargo tiff 0.11.3 decoder/Decoder#::newrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]new().(file).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 1926 |
let file_bo = decoder.byte_orderrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]byte_order().(); |
| 1927 |
let mut ifd = decoder.image_ifdrust-analyzer cargo tiff 0.11.3 decoder/impl#[`Decoder<R>`]image_ifd().(); |
| 1928 |
|
| 1929 |
{ |
| 1930 |
let value = ifd |
| 1931 |
.find_tagrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]find_tag().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::BitsPerSamplerust-analyzer cargo tiff 0.11.3 tags/Tag#BitsPerSample#) |
| 1932 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().() |
| 1933 |
.expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("must have BitsPerSample"); |
| 1934 |
|
| 1935 |
let samples = value.into_u16_vecrust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Value]into_u16_vec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 1936 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(samples.as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().(), [8, 8, 8]); |
| 1937 |
} |
| 1938 |
|
| 1939 |
{ |
| 1940 |
let mut value = ValueBufferrust-analyzer cargo tiff 0.11.3 tags/ValueBuffer#::from_valuerust-analyzer cargo tiff 0.11.3 tags/impl#[ValueBuffer]from_value().(&[0u16; 4]); |
| 1941 |
let _entry = ifd |
| 1942 |
.find_tag_bufrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]find_tag_buf().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::BitsPerSamplerust-analyzer cargo tiff 0.11.3 tags/Tag#BitsPerSample#, &mut value) |
| 1943 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().() |
| 1944 |
.expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("must have BitsPerSample"); |
| 1945 |
|
| 1946 |
value.set_byte_orderrust-analyzer cargo tiff 0.11.3 tags/impl#[ValueBuffer]set_byte_order().(ByteOrderrust-analyzer cargo tiff 0.11.3 tags/ByteOrder#::nativerust-analyzer cargo tiff 0.11.3 tags/impl#[ByteOrder]native().()); |
| 1947 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(value.as_bytesrust-analyzer cargo tiff 0.11.3 tags/impl#[ValueBuffer]as_bytes().(), bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::u16_as_ne_bytesrust-analyzer cargo tiff 0.11.3 bytecast/u16_as_ne_bytes().(&[8, 8, 8])); |
| 1948 |
} |
| 1949 |
|
| 1950 |
{ |
| 1951 |
let mut by_bytes = [0u16; 4]; |
| 1952 |
let entry = ifd |
| 1953 |
.find_entryrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]find_entry().(Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::BitsPerSamplerust-analyzer cargo tiff 0.11.3 tags/Tag#BitsPerSample#) |
| 1954 |
.expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("must have BitsPerSample"); |
| 1955 |
|
| 1956 |
let byte_len = ifd |
| 1957 |
.find_tag_bytesrust-analyzer cargo tiff 0.11.3 decoder/impl#[`IfdDecoder<'_>`]find_tag_bytes().( |
| 1958 |
Tagrust-analyzer cargo tiff 0.11.3 tags/Tag#::BitsPerSamplerust-analyzer cargo tiff 0.11.3 tags/Tag#BitsPerSample#, |
| 1959 |
bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::u16_as_ne_mut_bytesrust-analyzer cargo tiff 0.11.3 bytecast/u16_as_ne_mut_bytes().(&mut by_bytes), |
| 1960 |
0, |
| 1961 |
) |
| 1962 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().() |
| 1963 |
.expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("must have BitsPerSample"); |
| 1964 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(byte_len, 3 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<u16>()); |
| 1965 |
|
| 1966 |
file_bo.convertrust-analyzer cargo tiff 0.11.3 tags/impl#[ByteOrder]convert().( |
| 1967 |
entry.field_typerust-analyzer cargo tiff 0.11.3 decoder/ifd/impl#[Entry]field_type().(), |
| 1968 |
bytecastrust-analyzer cargo tiff 0.11.3 bytecast/::u16_as_ne_mut_bytesrust-analyzer cargo tiff 0.11.3 bytecast/u16_as_ne_mut_bytes().(&mut by_bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().), |
| 1969 |
ByteOrderrust-analyzer cargo tiff 0.11.3 tags/ByteOrder#::nativerust-analyzer cargo tiff 0.11.3 tags/impl#[ByteOrder]native().(), |
| 1970 |
); |
| 1971 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&by_bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., &[8, 8, 8]); |
| 1972 |
} |
| 1973 |
} |
| 1974 |
} |