Do not re-export Content and Tag by hiding the real tag module.
This commit is contained in:
parent
b66b47d1fd
commit
e939ef7fd6
|
@ -48,7 +48,8 @@ pub use error::Error;
|
||||||
pub use image::parse_image;
|
pub use image::parse_image;
|
||||||
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::{Context, Tag};
|
pub use tag_priv::{Context, Tag};
|
||||||
|
pub use tag_priv::constants as tag;
|
||||||
pub use tiff::Field;
|
pub use tiff::Field;
|
||||||
pub use tiff::parse_exif;
|
pub use tiff::parse_exif;
|
||||||
pub use value::Value;
|
pub use value::Value;
|
||||||
|
@ -63,7 +64,8 @@ mod error;
|
||||||
mod image;
|
mod image;
|
||||||
mod jpeg;
|
mod jpeg;
|
||||||
mod reader;
|
mod reader;
|
||||||
pub mod tag;
|
#[path = "tag.rs"]
|
||||||
|
mod tag_priv;
|
||||||
mod tiff;
|
mod tiff;
|
||||||
mod util;
|
mod util;
|
||||||
mod value;
|
mod value;
|
||||||
|
|
39
src/tag.rs
39
src/tag.rs
|
@ -24,16 +24,9 @@
|
||||||
// SUCH DAMAGE.
|
// SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
|
|
||||||
//! Compatibility warning: Exif tag constants in this module will be
|
|
||||||
//! converted to associated constants of Tag when the feature is
|
|
||||||
//! stabilized.
|
|
||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
/// A tag of a TIFF field.
|
/// A tag of a TIFF field.
|
||||||
///
|
|
||||||
/// Use `exif::Tag` instead of `exif::tag::Tag`. They are the same,
|
|
||||||
/// but `exif::tag` will become private in the future versions.
|
|
||||||
//
|
//
|
||||||
// This is not an enum to keep safety and API stability, while
|
// This is not an enum to keep safety and API stability, while
|
||||||
// supporting unknown tag values. This comment is based on the
|
// supporting unknown tag values. This comment is based on the
|
||||||
|
@ -83,9 +76,6 @@ impl fmt::Display for Tag {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An enum that indicates how a tag value is interpreted.
|
/// An enum that indicates how a tag value is interpreted.
|
||||||
///
|
|
||||||
/// Use `exif::Context` instead of `exif::tag::Context`. They are the
|
|
||||||
/// same, but `exif::tag` will become private in the future versions.
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||||
pub enum Context {
|
pub enum Context {
|
||||||
/// TIFF attributes defined in the TIFF Rev. 6.0 specification.
|
/// TIFF attributes defined in the TIFF Rev. 6.0 specification.
|
||||||
|
@ -106,11 +96,28 @@ macro_rules! generate_well_known_tag_constants {
|
||||||
($name:ident, $num:expr, $desc:expr)
|
($name:ident, $num:expr, $desc:expr)
|
||||||
),+, )+
|
),+, )+
|
||||||
) => (
|
) => (
|
||||||
$($(
|
/// A module that contains Exif tag constants.
|
||||||
$( #[$attr] )*
|
///
|
||||||
#[allow(non_upper_case_globals)]
|
/// Compatibility warning: Exif tag constants in this module will be
|
||||||
pub const $name: Tag = Tag($ctx, $num);
|
/// 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
|
||||||
|
// <https://github.com/rust-lang/rust/issues/25207>.
|
||||||
|
pub mod constants {
|
||||||
|
use super::{Context, Tag};
|
||||||
|
$($(
|
||||||
|
$( #[$attr] )*
|
||||||
|
#[allow(non_upper_case_globals)]
|
||||||
|
pub const $name: Tag = Tag($ctx, $num);
|
||||||
|
)+)+
|
||||||
|
}
|
||||||
|
|
||||||
// Use a separate module to avoid name conflicts between
|
// Use a separate module to avoid name conflicts between
|
||||||
// const Tag and static TagInfo.
|
// const Tag and static TagInfo.
|
||||||
|
@ -130,7 +137,7 @@ macro_rules! generate_well_known_tag_constants {
|
||||||
fn get_tag_info(tag: &Tag) -> Option<&tag_info::TagInfo> {
|
fn get_tag_info(tag: &Tag) -> Option<&tag_info::TagInfo> {
|
||||||
match *tag {
|
match *tag {
|
||||||
$($(
|
$($(
|
||||||
self::$name => Some(&tag_info::$name),
|
constants::$name => Some(&tag_info::$name),
|
||||||
)+)+
|
)+)+
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
use endian::{Endian, BigEndian, LittleEndian};
|
use endian::{Endian, BigEndian, LittleEndian};
|
||||||
use error::Error;
|
use error::Error;
|
||||||
use tag;
|
use tag;
|
||||||
use tag::{Context, Tag};
|
use tag_priv::{Context, Tag};
|
||||||
use value::Value;
|
use value::Value;
|
||||||
use value::get_type_info;
|
use value::get_type_info;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue