diff --git a/Cargo.toml b/Cargo.toml index a73c667..1228f8a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ name = "exif" version = "0.3.1" authors = ["KAMADA Ken'ichi "] +edition = "2018" description = "Exif parsing library written in pure Rust" documentation = "https://docs.rs/kamadak-exif" diff --git a/README b/README index 93569c4..172c1a5 100644 --- a/README +++ b/README @@ -15,7 +15,7 @@ Usage [dependencies] kamadak-exif = "0.3" - Add the following to your crate root. + Add the following to your crate root (before Rust 2018). extern crate exif; diff --git a/src/jpeg.rs b/src/jpeg.rs index 44cef6b..0138d6f 100644 --- a/src/jpeg.rs +++ b/src/jpeg.rs @@ -27,9 +27,8 @@ use std::io; use std::io::Read; -use error::Error; -use util::read8; -use util::read16; +use crate::error::Error; +use crate::util::{read8, read16}; mod marker { // The first byte of a marker. diff --git a/src/lib.rs b/src/lib.rs index 3998263..47c72d0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -62,7 +62,7 @@ pub use value::{Rational, SRational}; /// The interfaces in this module are experimental and unstable. pub mod experimental { - pub use writer::Writer; + pub use crate::writer::Writer; } #[cfg(test)] diff --git a/src/reader.rs b/src/reader.rs index b1e45af..73a501b 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -29,11 +29,11 @@ use std::io; use std::io::Read; use std::mem; -use error::Error; -use jpeg; -use tag::Tag; -use tiff; -use tiff::Field; +use crate::error::Error; +use crate::jpeg; +use crate::tag::Tag; +use crate::tiff; +use crate::tiff::Field; /// The `Reader` struct reads a JPEG or TIFF image, /// parses the Exif attributes in it, and holds the results. @@ -130,7 +130,7 @@ impl Reader { mod tests { use std::fs::File; use std::io::BufReader; - use value::Value; + use crate::value::Value; use super::*; static TIFF_ASCII: &'static [u8] = diff --git a/src/tag.rs b/src/tag.rs index 2ee078e..11f6c95 100644 --- a/src/tag.rs +++ b/src/tag.rs @@ -26,9 +26,9 @@ use std::fmt; -use value; -use value::Value; -use util::atou16; +use crate::value; +use crate::value::Value; +use crate::util::atou16; /// A tag of a TIFF field. /// @@ -144,8 +144,8 @@ macro_rules! generate_well_known_tag_constants { mod tag_info { use std::fmt; - use value::Value; - use value::DefaultValue; + use crate::value::Value; + use crate::value::DefaultValue; pub struct TagInfo { pub name: &'static str, @@ -583,7 +583,7 @@ fn d_resunit(w: &mut fmt::Write, value: &Value) -> fmt::Result { fn d_datetime(w: &mut fmt::Write, value: &Value) -> fmt::Result { if let Value::Ascii(ref v) = *value { if let Some(dt) = v.first() { - if let Ok(dt) = ::tiff::DateTime::from_ascii(dt) { + if let Ok(dt) = crate::tiff::DateTime::from_ascii(dt) { return write!(w, "{}", dt) } } diff --git a/src/tiff.rs b/src/tiff.rs index bca332b..9660b53 100644 --- a/src/tiff.rs +++ b/src/tiff.rs @@ -26,12 +26,12 @@ use std::fmt; -use endian::{Endian, BigEndian, LittleEndian}; -use error::Error; -use tag::{Context, Tag}; -use value::Value; -use value::get_type_info; -use util::{atou16, ctou32}; +use crate::endian::{Endian, BigEndian, LittleEndian}; +use crate::error::Error; +use crate::tag::{Context, Tag}; +use crate::value::Value; +use crate::value::get_type_info; +use crate::util::{atou16, ctou32}; // TIFF header magic numbers [EXIF23 4.5.2]. const TIFF_BE: u16 = 0x4d4d; diff --git a/src/util.rs b/src/util.rs index 51e498e..df0f5ea 100644 --- a/src/util.rs +++ b/src/util.rs @@ -26,7 +26,7 @@ use std::io; -use error::Error; +use crate::error::Error; const ASCII_0: u8 = 0x30; const ASCII_9: u8 = 0x39; diff --git a/src/value.rs b/src/value.rs index 697240b..70a242a 100644 --- a/src/value.rs +++ b/src/value.rs @@ -26,7 +26,7 @@ use std::fmt; -use endian::Endian; +use crate::endian::Endian; /// Types and values of TIFF fields (for Exif attributes). #[derive(Debug)] @@ -89,8 +89,8 @@ impl<'a> Value<'a> { /// "pixels per inch"); /// ``` #[inline] - pub fn display_as(&self, tag: ::tag::Tag) -> Display { - ::tag::display_value_as(self, tag) + pub fn display_as(&self, tag: crate::tag::Tag) -> Display { + crate::tag::display_value_as(self, tag) } /// Returns the unsigned integer at the given position. @@ -427,7 +427,7 @@ fn parse_unknown<'a>(data: &'a [u8], offset: usize, count: usize) #[cfg(test)] mod tests { - use endian::BigEndian; + use crate::endian::BigEndian; use super::*; #[test] @@ -621,7 +621,7 @@ mod tests { let sets: &[(&[u8], Vec)] = &[ (b"x", vec![]), (b"x\x7f\x7f\xff\xff\x80\x80\x00\x00\x40\x00\x00\x00", - vec![::std::f32::MAX, -::std::f32::MIN_POSITIVE, 2.0]), + vec![std::f32::MAX, -std::f32::MIN_POSITIVE, 2.0]), ]; let (unitlen, parser) = get_type_info::(11); for &(data, ref ans) in sets { @@ -640,7 +640,7 @@ mod tests { (b"x\x7f\xef\xff\xff\xff\xff\xff\xff\ \x80\x10\x00\x00\x00\x00\x00\x00\ \x40\x00\x00\x00\x00\x00\x00\x00", - vec![::std::f64::MAX, -::std::f64::MIN_POSITIVE, 2.0]), + vec![std::f64::MAX, -std::f64::MIN_POSITIVE, 2.0]), ]; let (unitlen, parser) = get_type_info::(12); for &(data, ref ans) in sets { diff --git a/src/writer.rs b/src/writer.rs index 02c8338..7791c64 100644 --- a/src/writer.rs +++ b/src/writer.rs @@ -27,11 +27,11 @@ use std::io; use std::io::{Seek, SeekFrom, Write}; -use endian::{Endian, BigEndian, LittleEndian}; -use error::Error; -use tag::{Context, Tag}; -use tiff::{Field, TIFF_BE_SIG, TIFF_LE_SIG}; -use value::Value; +use crate::endian::{Endian, BigEndian, LittleEndian}; +use crate::error::Error; +use crate::tag::{Context, Tag}; +use crate::tiff::{Field, TIFF_BE_SIG, TIFF_LE_SIG}; +use crate::value::Value; /// The `Writer` struct is used to encode and write Exif data. /// @@ -609,7 +609,7 @@ fn get_offset(w: &mut W) #[cfg(test)] mod tests { use std::io::Cursor; - use value::{Rational, SRational}; + use crate::value::{Rational, SRational}; use super::*; #[test]