Skip to content

Commit a05c5ad

Browse files
committed
Upgrade dependencies, MSRV, and various cleanups.
1 parent a97c68f commit a05c5ad

File tree

6 files changed

+42
-25
lines changed

6 files changed

+42
-25
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## [NEXT] - Unreleased
2+
* Require Rust 1.56 as the minimum supported language version.
3+
* Adopt 2021 edition of the language.
4+
* Dependency upgrades.
5+
16
## [v0.9.1] - 2020-07-12
27
* Fixed build failure on arm32 due to invalid assumptions about int size.
38
* Fixed null pointer crash when using `get_tag_raw()`.

Cargo.toml

+5-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ keywords = ["metadata", "exif", "iptc", "xmp", "photo"]
1717
categories = ["multimedia::images"]
1818
readme = "README.md"
1919

20-
edition = "2018"
20+
edition = "2021"
21+
rust-version = "1.56"
2122

2223
include = [
2324
"Cargo.toml",
@@ -29,10 +30,10 @@ include = [
2930
]
3031

3132
[dependencies]
32-
gexiv2-sys = "^1.1.1"
33+
gexiv2-sys = "1.2"
3334
libc = "0.2"
34-
num-rational = { version = "0.2", default-features = false }
35-
glib-sys = { version = "0.9", optional = true }
35+
num-rational = { version = "0.4", default-features = false }
36+
glib-sys = { version = "0.15", optional = true }
3637

3738
[features]
3839
raw-tag-access = ["gexiv2-sys/raw-tag-access", "glib-sys"]

README.md

+10-9
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ rexiv2
1818
Rust library for working with media file metadata
1919
-------------------------------------------------
2020

21-
This library provides a Rust wrapper around the [gexiv2][gexiv2] library,
22-
which is a GObject-based wrapper around the [Exiv2][exiv2] library, which
23-
provides read and write access to the Exif, XMP, and IPTC metadata in media
24-
files (typically photos) in various formats.
21+
This crate provides a Rust wrapper around the [gexiv2][gexiv2] library, which is
22+
a GObject-based wrapper around [Exiv2][exiv2], which provides read and write
23+
access to the Exif, XMP, and IPTC metadata in media files (typically photos) in
24+
various formats.
2525

2626
[gexiv2]: https://wiki.gnome.org/Projects/gexiv2
2727
[exiv2]: http://www.exiv2.org/
@@ -50,7 +50,7 @@ come in handy.
5050
Setup & Dependencies
5151
--------------------
5252

53-
rexiv2 requires Rust 1.31 or newer, and uses the 2018 edition of the language.
53+
rexiv2 requires Rust 1.56 or newer, and uses the 2021 edition of the language.
5454

5555
Being a wrapper for gexiv2 and Exiv2, rexiv2 obviously depends on them. These
5656
libraries are not bundled with rexiv2: you will need to install them separately.
@@ -61,10 +61,11 @@ For full instructions on how to get started with rexiv2, including how to
6161
install the prerequisite dependencies, refer to the [`SETUP`](SETUP.md) file.
6262

6363
Note that if you want BMFF support (e.g. HEIC, HEIF, AVIF, CR3, JXL/bmff files)
64-
you will need an up to date version of the underlying libraries (gexiv2 v0.13.0 and Exiv2 v0.27.4).
65-
You will also need to ensure that your version of Exiv2 has BMFF support enabled.
66-
This is generally enabled by default, but may be switched off in certain distributions
67-
due to licensing issues.
64+
you will need an up-to-date version of the underlying libraries (at least gexiv2
65+
v0.13.0 and Exiv2 v0.27.4). You will also need to ensure that your version of
66+
Exiv2 has BMFF support enabled. This is generally enabled by default, but may be
67+
switched off in certain distributions due to licensing issues.
68+
6869

6970
Versioning & History
7071
--------------------

SETUP.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ adding a dependency on rexiv2 in your crate’s `Cargo.toml` file:
9494

9595
```toml
9696
[dependencies]
97-
rexiv2 = "0.9.1"
97+
rexiv2 = "0.10"
9898
```
9999

100100
Alternatively, if you’d like to work off of the bleeding edge (note that this is

src/lib.rs

+20-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2015–2020 Felix A. Crux <[email protected]> and CONTRIBUTORS
1+
// Copyright © 2015–2022 Felix A. Crux <[email protected]> and CONTRIBUTORS
22
//
33
// This program is free software: you can redistribute it and/or modify
44
// it under the terms of the GNU General Public License as published by
@@ -1033,21 +1033,38 @@ pub fn get_tag_type(tag: &str) -> Result<TagType> {
10331033
///
10341034
/// # See also
10351035
///
1036-
/// Associated Gexiv2 Source Code: https://gitlab.gnome.org/GNOME/gexiv2/-/blob/e4d65b31cd77f28ef248117e161de9d8cc31d712/gexiv2/gexiv2-startup.cpp#L14
1036+
/// Associated Gexiv2 source code: https://gitlab.gnome.org/GNOME/gexiv2/-/blob/e4d65b31cd77f28ef248117e161de9d8cc31d712/gexiv2/gexiv2-startup.cpp#L14
10371037
///
10381038
/// # Examples
10391039
///
1040-
/// Simple call at the start of the application
1040+
/// It is normally sufficient to simply call the function in the usual
1041+
/// obvious way:
10411042
///
10421043
/// ```
10431044
/// fn main() {
10441045
/// rexiv2::initialize().expect("Unable to initialize rexiv2");
10451046
/// }
10461047
/// ```
1048+
///
1049+
/// However if you have a more complex multi-threaded environment, you
1050+
/// might want to ensure the function only gets set up once:
1051+
///
1052+
/// ```
1053+
/// use std::sync::{Once, ONCE_INIT};
1054+
///
1055+
/// fn main() {
1056+
/// static START: Once = ONCE_INIT;
1057+
///
1058+
/// START.call_once(|| unsafe {
1059+
/// rexiv2::initialize().expect("Unable to initialize rexiv2");
1060+
/// });
1061+
/// }
1062+
/// ```
10471063
pub fn initialize() -> Result<()> {
10481064
unsafe { int_bool_to_result(gexiv2::gexiv2_initialize()) }
10491065
}
10501066

1067+
10511068
// XMP namespace management.
10521069

10531070
/// Add a new XMP namespace for tags to exist under.

tst/main.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2016–2020 Felix A. Crux <[email protected]> and CONTRIBUTORS
1+
// Copyright © 2016–2022 Felix A. Crux <[email protected]> and CONTRIBUTORS
22
//
33
// This program is free software: you can redistribute it and/or modify
44
// it under the terms of the GNU General Public License as published by
@@ -21,14 +21,7 @@ use std::sync::Once;
2121

2222
static INIT: Once = Once::new();
2323

24-
///
2524
/// Should be called before any test runs. Will ensure that the library is initialized at most once.
26-
/// This would be the equivalent of a "beforeAll" function in other test libraries.
27-
///
28-
/// Future work: At some strange it might be good to work out if this can be done automatically
29-
/// by the test runner. It doesn't seem to be right now with the stock cargo test runner but
30-
/// it might be possible with 3rd party crates.
31-
///
3225
fn setup_test() {
3326
INIT.call_once(|| rexiv2::initialize().expect("Unable to initialize rexiv2"));
3427
}

0 commit comments

Comments
 (0)