Trait tiff::encoder::tiff_value::TiffValue

source ·
pub trait TiffValue {
    const BYTE_LEN: u8;
    const FIELD_TYPE: Type;

    // Required methods
    fn count(&self) -> usize;
    fn data(&self) -> Cow<'_, [u8]>;

    // Provided methods
    fn bytes(&self) -> usize { ... }
    fn write<W: Write>(&self, writer: &mut TiffWriter<W>) -> TiffResult<()> { ... }
}
Expand description

Trait for types that can be encoded in a tiff file

Required Associated Constants§

Required Methods§

source

fn count(&self) -> usize

source

fn data(&self) -> Cow<'_, [u8]>

Access this value as an contiguous sequence of bytes. If their is no trivial representation, allocate it on the heap.

Provided Methods§

source

fn bytes(&self) -> usize

source

fn write<W: Write>(&self, writer: &mut TiffWriter<W>) -> TiffResult<()>

Write this value to a TiffWriter. While the default implementation will work in all cases, it may require unnecessary allocations. The written bytes of any custom implementation MUST be the same as yielded by self.data().

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl TiffValue for f32

source§

const BYTE_LEN: u8 = 4u8

source§

const FIELD_TYPE: Type = Type::FLOAT

source§

fn count(&self) -> usize

source§

fn write<W: Write>(&self, writer: &mut TiffWriter<W>) -> TiffResult<()>

source§

fn data(&self) -> Cow<'_, [u8]>

source§

impl TiffValue for f64

source§

const BYTE_LEN: u8 = 8u8

source§

const FIELD_TYPE: Type = Type::DOUBLE

source§

fn count(&self) -> usize

source§

fn write<W: Write>(&self, writer: &mut TiffWriter<W>) -> TiffResult<()>

source§

fn data(&self) -> Cow<'_, [u8]>

source§

impl TiffValue for i8

source§

const BYTE_LEN: u8 = 1u8

source§

const FIELD_TYPE: Type = Type::SBYTE

source§

fn count(&self) -> usize

source§

fn write<W: Write>(&self, writer: &mut TiffWriter<W>) -> TiffResult<()>

source§

fn data(&self) -> Cow<'_, [u8]>

source§

impl TiffValue for i16

source§

const BYTE_LEN: u8 = 2u8

source§

const FIELD_TYPE: Type = Type::SSHORT

source§

fn count(&self) -> usize

source§

fn write<W: Write>(&self, writer: &mut TiffWriter<W>) -> TiffResult<()>

source§

fn data(&self) -> Cow<'_, [u8]>

source§

impl TiffValue for i32

source§

const BYTE_LEN: u8 = 4u8

source§

const FIELD_TYPE: Type = Type::SLONG

source§

fn count(&self) -> usize

source§

fn write<W: Write>(&self, writer: &mut TiffWriter<W>) -> TiffResult<()>

source§

fn data(&self) -> Cow<'_, [u8]>

source§

impl TiffValue for i64

source§

const BYTE_LEN: u8 = 8u8

source§

const FIELD_TYPE: Type = Type::SLONG8

source§

fn count(&self) -> usize

source§

fn write<W: Write>(&self, writer: &mut TiffWriter<W>) -> TiffResult<()>

source§

fn data(&self) -> Cow<'_, [u8]>

source§

impl TiffValue for str

source§

const BYTE_LEN: u8 = 1u8

source§

const FIELD_TYPE: Type = Type::ASCII

source§

fn count(&self) -> usize

source§

fn write<W: Write>(&self, writer: &mut TiffWriter<W>) -> TiffResult<()>

source§

fn data(&self) -> Cow<'_, [u8]>

source§

impl TiffValue for u8

source§

const BYTE_LEN: u8 = 1u8

source§

const FIELD_TYPE: Type = Type::BYTE

source§

fn count(&self) -> usize

source§

fn write<W: Write>(&self, writer: &mut TiffWriter<W>) -> TiffResult<()>

source§

fn data(&self) -> Cow<'_, [u8]>

source§

impl TiffValue for u16

source§

const BYTE_LEN: u8 = 2u8

source§

const FIELD_TYPE: Type = Type::SHORT

source§

fn count(&self) -> usize

source§

fn write<W: Write>(&self, writer: &mut TiffWriter<W>) -> TiffResult<()>

source§

fn data(&self) -> Cow<'_, [u8]>

source§

impl TiffValue for u32

source§

const BYTE_LEN: u8 = 4u8

source§

const FIELD_TYPE: Type = Type::LONG

source§

fn count(&self) -> usize

source§

fn write<W: Write>(&self, writer: &mut TiffWriter<W>) -> TiffResult<()>

source§

fn data(&self) -> Cow<'_, [u8]>

source§

impl TiffValue for u64

source§

const BYTE_LEN: u8 = 8u8

source§

const FIELD_TYPE: Type = Type::LONG8

source§

fn count(&self) -> usize

source§

fn write<W: Write>(&self, writer: &mut TiffWriter<W>) -> TiffResult<()>

source§

fn data(&self) -> Cow<'_, [u8]>

source§

impl TiffValue for [f32]

source§

const BYTE_LEN: u8 = 4u8

source§

const FIELD_TYPE: Type = Type::FLOAT

source§

fn count(&self) -> usize

source§

fn data(&self) -> Cow<'_, [u8]>

source§

impl TiffValue for [f64]

source§

const BYTE_LEN: u8 = 8u8

source§

const FIELD_TYPE: Type = Type::DOUBLE

source§

fn count(&self) -> usize

source§

fn data(&self) -> Cow<'_, [u8]>

source§

impl TiffValue for [i8]

source§

const BYTE_LEN: u8 = 1u8

source§

const FIELD_TYPE: Type = Type::SBYTE

source§

fn count(&self) -> usize

source§

fn data(&self) -> Cow<'_, [u8]>

source§

impl TiffValue for [i16]

source§

const BYTE_LEN: u8 = 2u8

source§

const FIELD_TYPE: Type = Type::SSHORT

source§

fn count(&self) -> usize

source§

fn data(&self) -> Cow<'_, [u8]>

source§

impl TiffValue for [i32]

source§

const BYTE_LEN: u8 = 4u8

source§

const FIELD_TYPE: Type = Type::SLONG

source§

fn count(&self) -> usize

source§

fn data(&self) -> Cow<'_, [u8]>

source§

impl TiffValue for [i64]

source§

const BYTE_LEN: u8 = 8u8

source§

const FIELD_TYPE: Type = Type::SLONG8

source§

fn count(&self) -> usize

source§

fn data(&self) -> Cow<'_, [u8]>

source§

impl TiffValue for [u8]

source§

const BYTE_LEN: u8 = 1u8

source§

const FIELD_TYPE: Type = Type::BYTE

source§

fn count(&self) -> usize

source§

fn data(&self) -> Cow<'_, [u8]>

source§

impl TiffValue for [u16]

source§

const BYTE_LEN: u8 = 2u8

source§

const FIELD_TYPE: Type = Type::SHORT

source§

fn count(&self) -> usize

source§

fn data(&self) -> Cow<'_, [u8]>

source§

impl TiffValue for [u32]

source§

const BYTE_LEN: u8 = 4u8

source§

const FIELD_TYPE: Type = Type::LONG

source§

fn count(&self) -> usize

source§

fn data(&self) -> Cow<'_, [u8]>

source§

impl TiffValue for [u64]

source§

const BYTE_LEN: u8 = 8u8

source§

const FIELD_TYPE: Type = Type::LONG8

source§

fn count(&self) -> usize

source§

fn data(&self) -> Cow<'_, [u8]>

source§

impl TiffValue for [Ifd8]

source§

const BYTE_LEN: u8 = 8u8

source§

const FIELD_TYPE: Type = Type::IFD8

source§

fn count(&self) -> usize

source§

fn write<W: Write>(&self, writer: &mut TiffWriter<W>) -> TiffResult<()>

source§

fn data(&self) -> Cow<'_, [u8]>

source§

impl TiffValue for [Ifd]

source§

const BYTE_LEN: u8 = 4u8

source§

const FIELD_TYPE: Type = Type::IFD

source§

fn count(&self) -> usize

source§

fn write<W: Write>(&self, writer: &mut TiffWriter<W>) -> TiffResult<()>

source§

fn data(&self) -> Cow<'_, [u8]>

source§

impl TiffValue for [Rational]

source§

const BYTE_LEN: u8 = 8u8

source§

const FIELD_TYPE: Type = Type::RATIONAL

source§

fn count(&self) -> usize

source§

fn write<W: Write>(&self, writer: &mut TiffWriter<W>) -> TiffResult<()>

source§

fn data(&self) -> Cow<'_, [u8]>

source§

impl TiffValue for [SRational]

source§

const BYTE_LEN: u8 = 8u8

source§

const FIELD_TYPE: Type = Type::SRATIONAL

source§

fn count(&self) -> usize

source§

fn write<W: Write>(&self, writer: &mut TiffWriter<W>) -> TiffResult<()>

source§

fn data(&self) -> Cow<'_, [u8]>

source§

impl<'a, T: TiffValue + ?Sized> TiffValue for &'a T

source§

const BYTE_LEN: u8 = T::BYTE_LEN

source§

const FIELD_TYPE: Type = T::FIELD_TYPE

source§

fn count(&self) -> usize

source§

fn write<W: Write>(&self, writer: &mut TiffWriter<W>) -> TiffResult<()>

source§

fn data(&self) -> Cow<'_, [u8]>

Implementors§

source§

impl TiffValue for Ifd8

source§

const BYTE_LEN: u8 = 8u8

source§

const FIELD_TYPE: Type = Type::IFD8

source§

impl TiffValue for Ifd

source§

const BYTE_LEN: u8 = 4u8

source§

const FIELD_TYPE: Type = Type::IFD

source§

impl TiffValue for Rational

source§

const BYTE_LEN: u8 = 8u8

source§

const FIELD_TYPE: Type = Type::RATIONAL

source§

impl TiffValue for SRational

source§

const BYTE_LEN: u8 = 8u8

source§

const FIELD_TYPE: Type = Type::SRATIONAL