capsule_library/exif.rs
1//! File-path EXIF reading over `capsule-core`'s reader-generic extractor.
2//!
3//! The parse is [`extract_exif_from_reader`], which takes any seekable reader; this module owns
4//! only opening the file, and re-exports the rest of `capsule_core::exif` so callers name one
5//! path.
6
7use std::fs::File;
8use std::io::BufReader;
9use std::path::Path;
10
11pub use capsule_core::exif::*;
12
13/// Open `path` and extract its EXIF fields.
14///
15/// A file that cannot be opened is an error; a readable file that holds no EXIF container is an
16/// all-`None` [`ExifExtract`], read only as far as the container sniff needs.
17pub fn extract_exif(path: &Path) -> Result<ExifExtract, Box<dyn std::error::Error + Send + Sync>> {
18 let mut reader = BufReader::new(File::open(path)?);
19 Ok(extract_exif_from_reader(&mut reader))
20}
21
22#[cfg(test)]
23mod tests;