Trait TiffKind
pub trait TiffKind
Trait to abstract over Tiff/BigTiff differences.
Implemented for TiffKindStandard and TiffKindBig.
Associated Types
type OffsetType: TryFrom<usize, Error = TryFromIntError> + Into<u64> + TiffValue;The type of offset fields,
u32for normal Tiff,u64for BigTiff.type OffsetArrayType: ?Sized + TiffValue;Needed for the
convert_slicemethod.
Required Methods
fn write_header<W: Write>(writer: &mut TiffWriter<W>) -> TiffResult<()>Write the (Big)Tiff header.
fn convert_offset(offset: u64) -> TiffResult<Self::OffsetType>Convert a file offset to
Self::OffsetType.This returns an error for normal Tiff if the offset is larger than
u32::MAX.fn write_offset<W: Write>(writer: &mut TiffWriter<W>, offset: u64) -> TiffResult<()>Write an offset value to the given writer.
Like
convert_offset, this errors ifoffset > u32::MAXfor normal Tiff.fn write_entry_count<W: Write>(writer: &mut TiffWriter<W>, count: usize) -> TiffResult<()>Write the IFD entry count field with the given
countvalue.The entry count field is an
u16for normal Tiff andu64for BigTiff. Errors if the givenusizeis larger than the representable values.fn convert_slice(slice: &[Self::OffsetType]) -> &Self::OffsetArrayTypeInternal helper method for satisfying Rust's type checker.
The
TiffValuetrait is implemented for both primitive values (e.g.u8,u32) and slices of primitive values (e.g.[u8],[u32]). However, this is not represented in the type system, so there is no guarantee that that for allT: TiffValuethere is also an implementation ofTiffValuefor[T]. This method works around that problem by providing a conversion from[T]to some value that implementsTiffValue, thereby making all slices ofOffsetTypeusable withwrite_tagand similar methods.Implementations of this trait should always set
OffsetArrayTypeto[OffsetType].
Implementors
impl TiffKind for TiffKindBigimpl TiffKind for TiffKindStandard