You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by tu...@apache.org on 2022/07/27 19:11:00 UTC

[arrow-rs] branch master updated: Simplify experimental macro (#2200)

This is an automated email from the ASF dual-hosted git repository.

tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/master by this push:
     new dfc7ef8a3 Simplify experimental macro (#2200)
dfc7ef8a3 is described below

commit dfc7ef8a3c4ddba1983a16a35d46e004a2e1ad06
Author: Raphael Taylor-Davies <17...@users.noreply.github.com>
AuthorDate: Wed Jul 27 20:10:54 2022 +0100

    Simplify experimental macro (#2200)
---
 parquet/src/arrow/mod.rs     |  4 ++--
 parquet/src/encodings/mod.rs |  2 +-
 parquet/src/lib.rs           | 35 ++++++++++++++---------------------
 3 files changed, 17 insertions(+), 24 deletions(-)

diff --git a/parquet/src/arrow/mod.rs b/parquet/src/arrow/mod.rs
index 3aee7cf42..18edd06d7 100644
--- a/parquet/src/arrow/mod.rs
+++ b/parquet/src/arrow/mod.rs
@@ -119,7 +119,7 @@
 //!}
 //! ```
 
-experimental_mod!(array_reader);
+experimental!(mod array_reader);
 pub mod arrow_reader;
 pub mod arrow_writer;
 mod buffer;
@@ -128,7 +128,7 @@ mod buffer;
 pub mod async_reader;
 
 mod record_reader;
-experimental_mod!(schema);
+experimental!(mod schema);
 
 pub use self::arrow_reader::ArrowReader;
 pub use self::arrow_reader::ParquetFileArrowReader;
diff --git a/parquet/src/encodings/mod.rs b/parquet/src/encodings/mod.rs
index 9577a8e62..894c4fb96 100644
--- a/parquet/src/encodings/mod.rs
+++ b/parquet/src/encodings/mod.rs
@@ -18,4 +18,4 @@
 pub mod decoding;
 pub mod encoding;
 pub mod levels;
-experimental_mod_crate!(rle);
+experimental!(pub(crate) mod rle);
diff --git a/parquet/src/lib.rs b/parquet/src/lib.rs
index e86b9e659..d4eaaf416 100644
--- a/parquet/src/lib.rs
+++ b/parquet/src/lib.rs
@@ -39,34 +39,27 @@
     clippy::too_many_arguments
 )]
 
-/// Defines a module with an experimental public API
+/// Defines a an item with an experimental public API
 ///
 /// The module will not be documented, and will only be public if the
 /// experimental feature flag is enabled
 ///
-/// Experimental modules have no stability guarantees
-macro_rules! experimental_mod {
-    ($module:ident $(, #[$meta:meta])*) => {
-        #[cfg(feature = "experimental")]
+/// Experimental components have no stability guarantees
+#[cfg(feature = "experimental")]
+macro_rules! experimental {
+    ($(#[$meta:meta])* $vis:vis mod $module:ident) => {
         #[doc(hidden)]
         $(#[$meta])*
         pub mod $module;
-        #[cfg(not(feature = "experimental"))]
-        $(#[$meta])*
-        mod $module;
-    };
+    }
 }
 
-macro_rules! experimental_mod_crate {
-    ($module:ident $(, #[$meta:meta])*) => {
-        #[cfg(feature = "experimental")]
-        #[doc(hidden)]
-        $(#[$meta])*
-        pub mod $module;
-        #[cfg(not(feature = "experimental"))]
+#[cfg(not(feature = "experimental"))]
+macro_rules! experimental {
+    ($(#[$meta:meta])* $vis:vis mod $module:ident) => {
         $(#[$meta])*
-        pub(crate) mod $module;
-    };
+        $vis mod $module;
+    }
 }
 
 #[macro_use]
@@ -85,12 +78,12 @@ pub use self::encodings::{decoding, encoding};
 #[doc(hidden)]
 pub use self::util::memory;
 
-experimental_mod!(util, #[macro_use]);
+experimental!(#[macro_use] mod util);
 #[cfg(any(feature = "arrow", test))]
 pub mod arrow;
 pub mod column;
-experimental_mod!(compression);
-experimental_mod!(encodings);
+experimental!(mod compression);
+experimental!(mod encodings);
 pub mod file;
 pub mod record;
 pub mod schema;