This is an automated email from the ASF dual-hosted git repository.
alamb 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 e838e62d19 add "ARROW_VERSION" const (#6379)
e838e62d19 is described below
commit e838e62d197cf0f6f653aa47aa00b5e5fb0b5f11
Author: Samuel Colvin <[email protected]>
AuthorDate: Wed Sep 11 22:09:20 2024 +0100
add "ARROW_VERSION" const (#6379)
---
arrow/examples/README.md | 1 +
arrow/examples/version.rs | 24 ++++++++++++++++++++++++
arrow/src/lib.rs | 4 +++-
3 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/arrow/examples/README.md b/arrow/examples/README.md
index 7ec3b008b7..5c57ec00cd 100644
--- a/arrow/examples/README.md
+++ b/arrow/examples/README.md
@@ -25,3 +25,4 @@
- [`read_csv.rs`](read_csv.rs): Reading CSV files with explicit schema, pretty
printing Arrays
- [`read_csv_infer_schema.rs`](read_csv_infer_schema.rs): Reading CSV files,
pretty printing Arrays
- [`tensor_builder.rs`](tensor_builder.rs): Using tensor builder
+- [`version.rs`](version.rs): Print the arrow version and exit
diff --git a/arrow/examples/version.rs b/arrow/examples/version.rs
new file mode 100644
index 0000000000..60dc933439
--- /dev/null
+++ b/arrow/examples/version.rs
@@ -0,0 +1,24 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! Print the arrow version and exit
+
+use arrow::ARROW_VERSION;
+
+fn main() {
+ println!("arrow version: {ARROW_VERSION}");
+}
diff --git a/arrow/src/lib.rs b/arrow/src/lib.rs
index 8796caf43e..581f871214 100644
--- a/arrow/src/lib.rs
+++ b/arrow/src/lib.rs
@@ -361,7 +361,6 @@
//! [Apache Parquet]: https://parquet.apache.org/
//! [DataFusion]: https://github.com/apache/arrow-datafusion
//! [issue tracker]: https://github.com/apache/arrow-rs/issues
-//!
#![deny(clippy::redundant_clone)]
#![warn(missing_debug_implementations)]
@@ -370,6 +369,9 @@ pub use arrow_array::{downcast_dictionary_array,
downcast_primitive_array};
pub use arrow_buffer::{alloc, buffer};
+/// Arrow crate version
+pub const ARROW_VERSION: &str = env!("CARGO_PKG_VERSION");
+
pub mod array;
pub mod compute;
#[cfg(feature = "csv")]