13
13
// You should have received a copy of the GNU General Public License
14
14
// along with this program. If not, see <http://www.gnu.org/licenses/>.
15
15
16
+ #![ allow( clippy:: needless_doctest_main) ]
17
+
16
18
//! This library provides a Rust wrapper around the [gexiv2][gexiv2] library,
17
19
//! which is itself a GObject-based wrapper around the [Exiv2][exiv2] library,
18
20
//! which provides read and write access to the Exif, XMP, and IPTC metadata
@@ -47,7 +49,7 @@ use std::str;
47
49
use std:: os:: unix:: ffi:: OsStrExt ;
48
50
49
51
/// A wrapper type for the kinds of errors one might encounter when using the library.
50
- #[ derive( Debug , PartialEq ) ]
52
+ #[ derive( Debug , PartialEq , Eq ) ]
51
53
pub enum Rexiv2Error {
52
54
/// No value found
53
55
NoValue ,
@@ -90,13 +92,13 @@ impl From<str::Utf8Error> for Rexiv2Error {
90
92
pub type Result < T > = std:: result:: Result < T , Rexiv2Error > ;
91
93
92
94
/// An opaque structure that serves as a container for a media file's metadata.
93
- #[ derive( Debug , PartialEq ) ]
95
+ #[ derive( Debug , PartialEq , Eq ) ]
94
96
pub struct Metadata {
95
97
raw : * mut gexiv2:: GExiv2Metadata ,
96
98
}
97
99
98
100
/// An opaque structure that serves as a container for a preview image.
99
- #[ derive( Debug , PartialEq ) ]
101
+ #[ derive( Debug , PartialEq , Eq ) ]
100
102
pub struct PreviewImage < ' a > {
101
103
raw : * mut gexiv2:: GExiv2PreviewProperties ,
102
104
metadata : & ' a Metadata , // Parent metadata to load a PreviewImage from a PreviewProperties.
@@ -111,7 +113,7 @@ pub struct GpsInfo {
111
113
}
112
114
113
115
/// The possible data types that a tag can have.
114
- #[ derive( Clone , Copy , Debug , Eq , PartialEq , Hash ) ]
116
+ #[ derive( Clone , Copy , Debug , PartialEq , Eq , Hash ) ]
115
117
pub enum TagType {
116
118
/// Exif BYTE type, 8-bit unsigned integer.
117
119
UnsignedByte ,
@@ -773,10 +775,7 @@ impl Metadata {
773
775
let mut n = 0 ;
774
776
while !( * ptr. offset ( n) ) . is_null ( ) {
775
777
let preview_prop = * ptr. offset ( n) ;
776
- previews. push ( PreviewImage {
777
- raw : preview_prop,
778
- metadata : self ,
779
- } ) ;
778
+ previews. push ( PreviewImage { raw : preview_prop, metadata : self } ) ;
780
779
n += 1 ;
781
780
}
782
781
Some ( previews)
@@ -792,11 +791,7 @@ impl Metadata {
792
791
let alt = & mut 0.0 ;
793
792
match unsafe { gexiv2:: gexiv2_metadata_get_gps_info ( self . raw , lon, lat, alt) } {
794
793
0 => None ,
795
- _ => Some ( GpsInfo {
796
- longitude : * lon,
797
- latitude : * lat,
798
- altitude : * alt,
799
- } ) ,
794
+ _ => Some ( GpsInfo { longitude : * lon, latitude : * lat, altitude : * alt } ) ,
800
795
}
801
796
}
802
797
0 commit comments