pub struct Writer<'a> { /* private fields */ }
Expand description

The Writer struct is used to encode and write Exif data.

Examples

use exif::{Field, In, Tag, Value};
use exif::experimental::Writer;
let image_desc = Field {
    tag: Tag::ImageDescription,
    ifd_num: In::PRIMARY,
    value: Value::Ascii(vec![b"Sample".to_vec()]),
};
let mut writer = Writer::new();
let mut buf = std::io::Cursor::new(Vec::new());
writer.push_field(&image_desc);
writer.write(&mut buf, false)?;
static expected: &[u8] =
    b"\x4d\x4d\x00\x2a\x00\x00\x00\x08\
      \x00\x01\x01\x0e\x00\x02\x00\x00\x00\x07\x00\x00\x00\x1a\
      \x00\x00\x00\x00\
      Sample\0";
assert_eq!(buf.into_inner(), expected);

Implementations

Constructs an empty Writer.

Appends a field to be written.

The fields can be appended in any order. Duplicate fields must not be appended.

The following fields are ignored and synthesized when needed: ExifIFDPointer, GPSInfoIFDPointer, InteropIFDPointer, StripOffsets, StripByteCounts, TileOffsets, TileByteCounts, JPEGInterchangeFormat, and JPEGInterchangeFormatLength.

Sets TIFF strips for the specified IFD. If this method is called multiple times, the last one is used.

Sets TIFF tiles for the specified IFD. If this method is called multiple times, the last one is used.

Sets JPEG data for the specified IFD. If this method is called multiple times, the last one is used.

Encodes Exif data and writes it into w.

The write position of w must be set to zero before calling this method.

Trait Implementations

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 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.