From 56106534cd218cf0f008cf602858f13a4f402098 Mon Sep 17 00:00:00 2001 From: KAMADA Ken'ichi Date: Sun, 31 Mar 2019 23:50:04 +0900 Subject: [PATCH] Remove the deprecated tag module. --- src/lib.rs | 15 +++++---------- src/reader.rs | 2 +- src/tag.rs | 36 ++++++++++-------------------------- src/tiff.rs | 2 +- src/value.rs | 4 ++-- src/writer.rs | 2 +- 6 files changed, 20 insertions(+), 41 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 8a4fced..3998263 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -46,19 +46,15 @@ //! //! # Compatibility //! -//! Major changes between 0.2.3 and 0.3 are listed below. +//! Major changes between 0.3.1 and 0.4 are listed below. //! -//! * Enum Error has two new variants: TooBig and NotSupported. -//! * Value::Undefined has the 2nd member to keep the offset of the value. -//! * Struct DateTime has two new fields: nanosecond and offset. -//! * The tag constants have been changed to associated constants of -//! struct `Tag`. Use `Tag::TagName` instead of `tag::TagName`. +//! * The constants in tag module (`tag::TagName`) have been removed. +//! Use `Tag::TagName` instead. pub use error::Error; pub use jpeg::get_exif_attr as get_exif_attr_from_jpeg; pub use reader::Reader; -pub use tag_priv::{Context, Tag}; -pub use tag_priv::constants as tag; +pub use tag::{Context, Tag}; pub use tiff::{DateTime, Field}; pub use tiff::parse_exif; pub use value::Value; @@ -77,8 +73,7 @@ mod endian; mod error; mod jpeg; mod reader; -#[path = "tag.rs"] -mod tag_priv; +mod tag; mod tiff; mod util; mod value; diff --git a/src/reader.rs b/src/reader.rs index d04613c..b1e45af 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -31,7 +31,7 @@ use std::mem; use error::Error; use jpeg; -use tag_priv::Tag; +use tag::Tag; use tiff; use tiff::Field; diff --git a/src/tag.rs b/src/tag.rs index c7c6a7e..2ee078e 100644 --- a/src/tag.rs +++ b/src/tag.rs @@ -124,30 +124,16 @@ macro_rules! generate_well_known_tag_constants { ($name:ident, $num:expr, $defval:expr, $dispval:ident, $desc:expr) ),+, )+ ) => ( - /// A module that contains Exif tag constants. - /// - /// Compatibility warning: Exif tag constants in this module will be - /// converted to associated constants of `Tag` when the feature is - /// stabilized. - /// - /// It is not recommended to import the constants directly into - /// your namespace; import the module and use with the module name - /// like `tag::DateTime`. The constant names follow the Exif - /// specification but not the Rust naming conventions, and a user - /// of the constants will get the non_upper_case_globals warning - /// if a bare constant is used in a match arm. - // This is discussed in - // . - pub mod constants { - use super::{Context, Tag}; - $($( - $( #[$attr] )* - #[allow(non_upper_case_globals)] - #[deprecated(since = "0.3.0", note = "use `Tag::TagName` instead of `tag::TagName`")] - pub const $name: Tag = Tag($ctx, $num); - )+)+ - } - + // This is not relevant for associated constants, because + // they cannot be imported even with "uniform paths". + // /// It is not recommended to import the constants directly into + // /// your namespace; import the module and use with the module name + // /// like `tag::DateTime`. The constant names follow the Exif + // /// specification but not the Rust naming conventions, and a user + // /// of the constants will get the non_upper_case_globals warning + // /// if a bare constant is used in a match arm. + // // This is discussed in + // // . impl Tag { $($( $( #[$attr] )* @@ -156,8 +142,6 @@ macro_rules! generate_well_known_tag_constants { )+)+ } - // Use a separate module to avoid name conflicts between - // const Tag and static TagInfo. mod tag_info { use std::fmt; use value::Value; diff --git a/src/tiff.rs b/src/tiff.rs index 7562505..bca332b 100644 --- a/src/tiff.rs +++ b/src/tiff.rs @@ -28,7 +28,7 @@ use std::fmt; use endian::{Endian, BigEndian, LittleEndian}; use error::Error; -use tag_priv::{Context, Tag}; +use tag::{Context, Tag}; use value::Value; use value::get_type_info; use util::{atou16, ctou32}; diff --git a/src/value.rs b/src/value.rs index c8073c9..697240b 100644 --- a/src/value.rs +++ b/src/value.rs @@ -89,8 +89,8 @@ impl<'a> Value<'a> { /// "pixels per inch"); /// ``` #[inline] - pub fn display_as(&self, tag: ::tag_priv::Tag) -> Display { - ::tag_priv::display_value_as(self, tag) + pub fn display_as(&self, tag: ::tag::Tag) -> Display { + ::tag::display_value_as(self, tag) } /// Returns the unsigned integer at the given position. diff --git a/src/writer.rs b/src/writer.rs index bfdf2ef..02c8338 100644 --- a/src/writer.rs +++ b/src/writer.rs @@ -29,7 +29,7 @@ use std::io::{Seek, SeekFrom, Write}; use endian::{Endian, BigEndian, LittleEndian}; use error::Error; -use tag_priv::{Context, Tag}; +use tag::{Context, Tag}; use tiff::{Field, TIFF_BE_SIG, TIFF_LE_SIG}; use value::Value;