Skip to main content

ptars/
lib.rs

1//! # ptars
2//!
3//! Fast conversion from Protocol Buffers to Apache Arrow and back.
4//!
5//! This crate provides efficient conversion between Protocol Buffer messages
6//! and Apache Arrow record batches, enabling high-performance data processing
7//! pipelines that bridge the protobuf and Arrow ecosystems.
8//!
9//! ## Features
10//!
11//! - Convert protobuf messages to Arrow RecordBatch
12//! - Convert Arrow RecordBatch back to protobuf messages
13//! - Support for nested messages, repeated fields, and maps
14//! - Special handling for well-known types (Timestamp, Date, TimeOfDay, wrapper types)
15//!
16//! ## Example
17//!
18//! ```ignore
19//! use ptars::{messages_to_record_batch, binary_array_to_record_batch};
20//! use prost_reflect::{DescriptorPool, DynamicMessage};
21//!
22//! // Load your protobuf descriptor
23//! let pool = DescriptorPool::decode(descriptor_bytes).unwrap();
24//! let message_descriptor = pool.get_message_by_name("my.Message").unwrap();
25//!
26//! // Convert messages to Arrow
27//! let messages: Vec<DynamicMessage> = /* your messages */;
28//! let record_batch = messages_to_record_batch(&messages, &message_descriptor);
29//! ```
30
31pub mod arrow_to_proto;
32pub mod config;
33pub mod proto_to_arrow;
34
35#[cfg(test)]
36mod converter;
37
38// Re-export commonly used items
39pub use arrow_to_proto::record_batch_to_array;
40pub use config::PtarsConfig;
41pub use proto_to_arrow::{
42    binary_array_to_messages, binary_array_to_record_batch,
43    binary_array_to_record_batch_with_config, messages_to_record_batch,
44    messages_to_record_batch_with_config,
45};