Struct exif::experimental::Writer
source · 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§
source§impl<'a> Writer<'a>
impl<'a> Writer<'a>
sourcepub fn push_field(&mut self, field: &'a Field)
pub fn push_field(&mut self, field: &'a Field)
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.
sourcepub fn set_strips(&mut self, strips: &'a [&'a [u8]], ifd_num: In)
pub fn set_strips(&mut self, strips: &'a [&'a [u8]], ifd_num: In)
Sets TIFF strips for the specified IFD. If this method is called multiple times, the last one is used.
sourcepub fn set_tiles(&mut self, tiles: &'a [&'a [u8]], ifd_num: In)
pub fn set_tiles(&mut self, tiles: &'a [&'a [u8]], ifd_num: In)
Sets TIFF tiles for the specified IFD. If this method is called multiple times, the last one is used.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Writer<'a>
impl<'a> RefUnwindSafe for Writer<'a>
impl<'a> Send for Writer<'a>
impl<'a> Sync for Writer<'a>
impl<'a> Unpin for Writer<'a>
impl<'a> UnwindSafe for Writer<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more