Skip to main content

fraiseql_wire/
lib.rs

1//! fraiseql-wire: Streaming JSON query engine for Postgres 17
2//!
3//! This crate provides a minimal, async Rust query engine that streams JSON
4//! data from Postgres with low latency and bounded memory usage.
5//!
6//! # Supported Query Shape
7//!
8//! ```sql
9//! SELECT data
10//! FROM v_{entity}
11//! WHERE predicate
12//! [ORDER BY expression]
13//! ```
14
15#![warn(missing_docs, rust_2018_idioms)]
16// Wave 9 (Q4): all library decoders/encoders/validators are panic-free
17// w.r.t. slice/vec indexing. Test files and examples opt out individually
18// with `#![allow(clippy::indexing_slicing)]` + `// Reason:`.
19#![deny(clippy::indexing_slicing)]
20// Pedantic allows — workspace sets `pedantic = deny`. These are grouped and
21// justified per Q3 / F053 (see `IMPROVEMENTS.md`). Two categories:
22//
23//   1. Wire-protocol cast suppressions — binary decoders that are statically
24//      bounded by the protocol contract (counts, lengths, offsets fit in the
25//      target type by construction).
26//   2. Crate-wide style preferences — binary-protocol code prizes locality and
27//      explicitness over the rust-idiomatic alternatives clippy prefers.
28//
29// Test-bleed lints (`unreadable_literal`, `explicit_iter_loop`) have been
30// moved to per-module `#![allow]` inside `mod tests` so the suppression
31// scope matches the locus of the fires.
32//
33// === Wire-protocol cast suppressions (binary decoders, statically bounded) ===
34#![allow(clippy::cast_precision_loss)] // Reason: intentional f64 conversions for metrics counters
35#![allow(clippy::cast_possible_truncation)] // Reason: intentional usize/u64 casts for buffer sizes
36#![allow(clippy::cast_sign_loss)] // Reason: duration/size values are always positive
37#![allow(clippy::cast_possible_wrap)] // Reason: byte counts within positive range
38#![allow(clippy::format_push_string)] // Reason: incremental query string building
39#![allow(clippy::needless_continue)] // Reason: explicit continues in wire protocol loops
40#![allow(clippy::iter_with_drain)] // Reason: drain pattern for ownership transfer in buffers
41#![allow(clippy::no_effect_underscore_binding)]
42// Reason: placeholder bindings for protocol fields
43// === Crate-wide style preferences (binary-protocol locality and explicitness) ===
44#![allow(clippy::items_after_statements)] // Reason: helper structs near point of use for clarity
45#![allow(clippy::match_same_arms)] // Reason: explicit arms document each protocol variant
46#![allow(clippy::manual_let_else)] // Reason: match with early return is clearer here
47#![allow(clippy::needless_pass_by_value)] // Reason: API consistency with async trait bounds
48#![allow(clippy::implicit_hasher)] // Reason: HashMap type params explicit at call sites
49#![allow(clippy::doc_link_with_quotes)] // Reason: quoted protocol names in docs are intentional
50#![allow(clippy::doc_markdown)] // Reason: parameter names in docstrings without backticks
51
52#[cfg(not(unix))]
53compile_error!("fraiseql-wire only supports Unix-like operating systems (Linux, macOS).");
54
55pub mod auth;
56pub mod client;
57pub mod connection;
58pub mod error;
59pub mod json;
60pub mod metrics;
61pub mod operators;
62pub mod protocol;
63pub mod stream;
64pub mod util;
65
66// Re-export commonly used types
67pub use client::FraiseClient;
68pub use error::{Result, WireError};
69pub use operators::{Field, OrderByClause, SortOrder, Value, WhereOperator};
70
71/// Library version
72pub const VERSION: &str = env!("CARGO_PKG_VERSION");