Skip to content

Commit db7a22a

Browse files
committed
Fixed the example in the Readme
1 parent 851cd0e commit db7a22a

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,22 @@ Read IPTC tags from JPEG files, in pure Rust.
99

1010
```rs
1111
use iptc::IPTC;
12+
use iptc::IPTCTag;
13+
use std::error::Error;
1214
use std::path::Path;
1315

14-
let image_path = Path::new("image.png");
15-
let mut tags = IPTC::read_from_path(&image_path);
16+
fn main() -> Result<(), Box<dyn Error>> {
17+
let image_path = Path::new("tests/smiley.jpg");
1618

17-
let city = tags.get(IPTCTag::City)
19+
let iptc = IPTC::read_from_path(&image_path)?;
1820

19-
assert_eq!(city, "London");
21+
// See all the tags in the image
22+
println!("IPTC: {:?}", iptc.get_all());
23+
24+
// Get a specific tag
25+
let keywords = iptc.get(IPTCTag::Keywords);
26+
println!("keywords: {}", keywords);
27+
28+
Ok(())
29+
}
2030
```

0 commit comments

Comments
 (0)