[−][src]Struct exif::Field
A TIFF field.
Fields
tag: Tag
The tag of this field.
ifd_num: In
The index of the IFD to which this field belongs.
value: Value
The value of this field.
Implementations
impl Field
[src]
pub fn display_value(&self) -> DisplayValue
[src]
Returns an object that implements std::fmt::Display
for
printing the value of this field in a tag-specific format.
To print the value with the unit, call with_unit
method on the
returned object. It takes a parameter, which is either ()
,
&Field
, or &Exif
, that provides the unit information.
If the unit does not depend on another field, ()
can be used.
Otherwise, &Field
or &Exif
should be used.
Examples
use exif::{Field, In, Tag, Value}; let xres = Field { tag: Tag::XResolution, ifd_num: In::PRIMARY, value: Value::Rational(vec![(72, 1).into()]), }; let resunit = Field { tag: Tag::ResolutionUnit, ifd_num: In::PRIMARY, value: Value::Short(vec![3]), }; assert_eq!(xres.display_value().to_string(), "72"); assert_eq!(resunit.display_value().to_string(), "cm"); // The unit of XResolution is indicated by ResolutionUnit. assert_eq!(xres.display_value().with_unit(&resunit).to_string(), "72 pixels per cm"); // If ResolutionUnit is not given, the default value is used. assert_eq!(xres.display_value().with_unit(()).to_string(), "72 pixels per inch"); assert_eq!(xres.display_value().with_unit(&xres).to_string(), "72 pixels per inch"); let flen = Field { tag: Tag::FocalLengthIn35mmFilm, ifd_num: In::PRIMARY, value: Value::Short(vec![24]), }; // The unit of the focal length is always mm, so the argument // has nothing to do with the result. assert_eq!(flen.display_value().with_unit(()).to_string(), "24 mm"); assert_eq!(flen.display_value().with_unit(&resunit).to_string(), "24 mm");
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Field
impl Send for Field
impl Sync for Field
impl Unpin for Field
impl UnwindSafe for Field
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,