pub enum Value {
Show 13 variants Byte(Vec<u8>), Ascii(Vec<Vec<u8>>), Short(Vec<u16>), Long(Vec<u32>), Rational(Vec<Rational>), SByte(Vec<i8>), Undefined(Vec<u8>, u32), SShort(Vec<i16>), SLong(Vec<i32>), SRational(Vec<SRational>), Float(Vec<f32>), Double(Vec<f64>), Unknown(u16u32u32),
}
Expand description

A type and values of a TIFF/Exif field.

Variants

Byte(Vec<u8>)

Vector of 8-bit unsigned integers.

Ascii(Vec<Vec<u8>>)

Vector of slices of 8-bit bytes containing 7-bit ASCII characters. The trailing null characters are not included. Note that the 8th bits may present if a non-conforming data is given.

Short(Vec<u16>)

Vector of 16-bit unsigned integers.

Long(Vec<u32>)

Vector of 32-bit unsigned integers.

Rational(Vec<Rational>)

Vector of unsigned rationals. An unsigned rational number is a pair of 32-bit unsigned integers.

SByte(Vec<i8>)

Vector of 8-bit signed integers. Unused in the Exif specification.

Undefined(Vec<u8>, u32)

Slice of 8-bit bytes.

The second member keeps the offset of the value in the Exif data. The interpretation of the value does not generally depend on the location, but if it does, the offset information helps. When encoding Exif, it is ignored.

SShort(Vec<i16>)

Vector of 16-bit signed integers. Unused in the Exif specification.

SLong(Vec<i32>)

Vector of 32-bit signed integers.

SRational(Vec<SRational>)

Vector of signed rationals. A signed rational number is a pair of 32-bit signed integers.

Float(Vec<f32>)

Vector of 32-bit (single precision) floating-point numbers. Unused in the Exif specification.

Double(Vec<f64>)

Vector of 64-bit (double precision) floating-point numbers. Unused in the Exif specification.

Unknown(u16u32u32)

The type is unknown to this implementation. The associated values are the type, the count, and the offset of the “Value Offset” element.

Implementations

Returns an object that implements std::fmt::Display for printing a value in a tag-specific format. The tag of the value is specified as the argument.

If you want to display with the unit, use Field::display_value.

Examples
use exif::{Value, Tag};
let val = Value::Undefined(b"0231".to_vec(), 0);
assert_eq!(val.display_as(Tag::ExifVersion).to_string(), "2.31");
let val = Value::Short(vec![2]);
assert_eq!(val.display_as(Tag::ResolutionUnit).to_string(), "inch");

Returns UIntValue if the value type is unsigned integer (BYTE, SHORT, or LONG). Otherwise exif::Error is returned.

The integer(s) can be obtained by get(&self, index: usize) method on UIntValue, which returns Option<u32>. None is returned if the index is out of bounds.

Examples
let v = Value::Byte(vec![1u8, 2]);
assert_eq!(v.as_uint()?.get(0), Some(1u32));
assert_eq!(v.as_uint()?.get(2), None);
let v = Value::SLong(vec![1, 2]);
assert!(v.as_uint().is_err());

Returns the unsigned integer at the given position. None is returned if the value type is not unsigned integer (BYTE, SHORT, or LONG) or the position is out of bounds.

Returns an iterator over the unsigned integers (BYTE, SHORT, or LONG). The iterator yields u32 regardless of the underlying integer size. The returned iterator implements Iterator and ExactSizeIterator traits. None is returned if the value is not an unsigned integer type.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.