dsq-shared
Shared types and utilities for DSQ crates.
The dsq-shared crate provides common types, utilities, and operations used across multiple DSQ crates. It serves as the foundation for type-safe data processing and shared functionality.
Key Components
Value Type System
The core Value enum bridges between JSON-like values and Polars DataFrames:
use Value;
let json_val = object;
let df_val = dataframe; // Polars DataFrame
let series_val = series; // Polars Series
Operations Framework
The Operation trait provides a composable interface for data transformations:
use ;
let field_op = new;
let result = field_op.apply?; // Returns Value::Int(30)
Utility Functions
Common utilities for data processing:
use ;
// HashMap creation helper
let map = hashmap;
// String utilities
assert!;
assert_eq!;
// Constants for configuration
let batch_size = DEFAULT_BATCH_SIZE; // 1000
let buffer_size = LARGE_BUFFER_SIZE; // 128KB
Error Handling
Standardized error types and utilities:
use error;
let err = operation_error;
let config_err = config_error;
Build Information
Runtime access to build metadata:
use ;
println!;
let build_info = BuildInfo ;
println!;
Installation
Add this to your Cargo.toml:
[]
= "0.1"
Or for the latest development version:
[]
= { = "https://github.com/durableprogramming/dsq", = "main" }
Requirements
- Rust 1.69 or later
- For full functionality: Polars with appropriate features
Dependencies
- Polars - High-performance DataFrame operations
- Serde - Serialization support
- Chrono - Date/time handling
- Num-bigint - Arbitrary precision integers
- Indexmap - Ordered maps
API Reference
Full API documentation is available at docs.rs/dsq-shared.
Contributing
Contributions are welcome! Please see the main CONTRIBUTING.md file for guidelines.
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.