Remove the deprecated tag module.

This commit is contained in:
KAMADA Ken'ichi 2019-03-31 23:50:04 +09:00
parent f9c4ff475b
commit 56106534cd
6 changed files with 20 additions and 41 deletions

View File

@ -46,19 +46,15 @@
//! //!
//! # Compatibility //! # 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. //! * The constants in tag module (`tag::TagName`) have been removed.
//! * Value::Undefined has the 2nd member to keep the offset of the value. //! Use `Tag::TagName` instead.
//! * 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`.
pub use error::Error; pub use error::Error;
pub use jpeg::get_exif_attr as get_exif_attr_from_jpeg; pub use jpeg::get_exif_attr as get_exif_attr_from_jpeg;
pub use reader::Reader; pub use reader::Reader;
pub use tag_priv::{Context, Tag}; pub use tag::{Context, Tag};
pub use tag_priv::constants as tag;
pub use tiff::{DateTime, Field}; pub use tiff::{DateTime, Field};
pub use tiff::parse_exif; pub use tiff::parse_exif;
pub use value::Value; pub use value::Value;
@ -77,8 +73,7 @@ mod endian;
mod error; mod error;
mod jpeg; mod jpeg;
mod reader; mod reader;
#[path = "tag.rs"] mod tag;
mod tag_priv;
mod tiff; mod tiff;
mod util; mod util;
mod value; mod value;

View File

@ -31,7 +31,7 @@ use std::mem;
use error::Error; use error::Error;
use jpeg; use jpeg;
use tag_priv::Tag; use tag::Tag;
use tiff; use tiff;
use tiff::Field; use tiff::Field;

View File

@ -124,30 +124,16 @@ macro_rules! generate_well_known_tag_constants {
($name:ident, $num:expr, $defval:expr, $dispval:ident, $desc:expr) ($name:ident, $num:expr, $defval:expr, $dispval:ident, $desc:expr)
),+, )+ ),+, )+
) => ( ) => (
/// A module that contains Exif tag constants. // This is not relevant for associated constants, because
/// // they cannot be imported even with "uniform paths".
/// Compatibility warning: Exif tag constants in this module will be // /// It is not recommended to import the constants directly into
/// converted to associated constants of `Tag` when the feature is // /// your namespace; import the module and use with the module name
/// stabilized. // /// like `tag::DateTime`. The constant names follow the Exif
/// // /// specification but not the Rust naming conventions, and a user
/// It is not recommended to import the constants directly into // /// of the constants will get the non_upper_case_globals warning
/// your namespace; import the module and use with the module name // /// if a bare constant is used in a match arm.
/// like `tag::DateTime`. The constant names follow the Exif // // This is discussed in
/// specification but not the Rust naming conventions, and a user // // <https://github.com/rust-lang/rust/issues/25207>.
/// 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
// <https://github.com/rust-lang/rust/issues/25207>.
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);
)+)+
}
impl Tag { impl Tag {
$($( $($(
$( #[$attr] )* $( #[$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 { mod tag_info {
use std::fmt; use std::fmt;
use value::Value; use value::Value;

View File

@ -28,7 +28,7 @@ use std::fmt;
use endian::{Endian, BigEndian, LittleEndian}; use endian::{Endian, BigEndian, LittleEndian};
use error::Error; use error::Error;
use tag_priv::{Context, Tag}; use tag::{Context, Tag};
use value::Value; use value::Value;
use value::get_type_info; use value::get_type_info;
use util::{atou16, ctou32}; use util::{atou16, ctou32};

View File

@ -89,8 +89,8 @@ impl<'a> Value<'a> {
/// "pixels per inch"); /// "pixels per inch");
/// ``` /// ```
#[inline] #[inline]
pub fn display_as(&self, tag: ::tag_priv::Tag) -> Display { pub fn display_as(&self, tag: ::tag::Tag) -> Display {
::tag_priv::display_value_as(self, tag) ::tag::display_value_as(self, tag)
} }
/// Returns the unsigned integer at the given position. /// Returns the unsigned integer at the given position.

View File

@ -29,7 +29,7 @@ use std::io::{Seek, SeekFrom, Write};
use endian::{Endian, BigEndian, LittleEndian}; use endian::{Endian, BigEndian, LittleEndian};
use error::Error; use error::Error;
use tag_priv::{Context, Tag}; use tag::{Context, Tag};
use tiff::{Field, TIFF_BE_SIG, TIFF_LE_SIG}; use tiff::{Field, TIFF_BE_SIG, TIFF_LE_SIG};
use value::Value; use value::Value;