Migrate to Rust 2018.

This commit is contained in:
KAMADA Ken'ichi 2019-04-01 21:11:54 +09:00
parent 56106534cd
commit eb4723a8a9
10 changed files with 36 additions and 36 deletions

View File

@ -2,6 +2,7 @@
name = "exif"
version = "0.3.1"
authors = ["KAMADA Ken'ichi <kamada@nanohz.org>"]
edition = "2018"
description = "Exif parsing library written in pure Rust"
documentation = "https://docs.rs/kamadak-exif"

2
README
View File

@ -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;

View File

@ -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.

View File

@ -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)]

View File

@ -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] =

View File

@ -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)
}
}

View File

@ -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;

View File

@ -26,7 +26,7 @@
use std::io;
use error::Error;
use crate::error::Error;
const ASCII_0: u8 = 0x30;
const ASCII_9: u8 = 0x39;

View File

@ -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<f32>)] = &[
(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::<BigEndian>(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::<BigEndian>(12);
for &(data, ref ans) in sets {

View File

@ -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>(w: &mut W)
#[cfg(test)]
mod tests {
use std::io::Cursor;
use value::{Rational, SRational};
use crate::value::{Rational, SRational};
use super::*;
#[test]