paft-utils 0.9.0

Utility helpers shared across the paft workspace.
Documentation
#![forbid(unsafe_code)]
#![warn(missing_docs)]

//! Shared utility helpers used across the paft workspace.
//!
//! This crate provides:
//! - Canonical string utilities (`Canonical`, `canonicalize`) for enum `Other` variants
//!   with a bounded stored-token length (`MAX_CANONICAL_TOKEN_LEN`)
//! - Optional dataframe helpers for converting domain structs to `polars` frames
//!
//! # Quickstart
//! ```rust
//! use paft_utils::{canonicalize, Canonical};
//!
//! // Normalize provider strings into canonical tokens
//! assert_eq!(canonicalize("Euronext Paris"), "EURONEXT_PARIS");
//!
//! // Validate non-empty canonical tokens via the `Canonical` wrapper
//! let c = Canonical::try_new("nasdaq").unwrap();
//! assert_eq!(c.as_str(), "NASDAQ");
//! ```
//!
//! # Feature flags
//! - `dataframe`: enable lightweight dataframe traits for `polars`

#[cfg(feature = "dataframe")]
pub mod dataframe;
pub mod string_canonical;

#[cfg(feature = "dataframe")]
pub use dataframe::{Columnar, Decimal128Encode, ToDataFrame, ToDataFrameVec};
pub use string_canonical::{
    Canonical, CanonicalError, MAX_CANONICAL_TOKEN_LEN, StringCode, canonicalize,
    has_canonical_token_boundaries,
};