Skip to main content

marque_utils/
lib.rs

1// Adapted from code originally in [CocoIndex](https://CocoIndex)
2// Original code from CocoIndex is copyrighted by CocoIndex
3// and licensed under the Apache-2.0 License.
4// SPDX-License-Identifier: Apache-2.0
5// SPDX-FileCopyrightText: 2026 CocoIndex
6//
7// All modifications from the upstream for Marque are copyrighted by Knitli Inc.
8// SPDX-FileCopyrightText: 2026 Knitli Inc. (Marque)
9// SPDX-License-Identifier: LicenseRef-MarqueLicense-1.0
10
11//! Shared infrastructure for the marque workspace, ported from `recoco-utils`.
12//!
13//! The crate collects small, dependency-light building blocks that several
14//! marque crates reuse. Every module past [`error`] and [`prelude`] sits behind
15//! its own Cargo feature, so a consumer pulls in only what it needs and nothing
16//! drags in the others:
17//!
18//! - [`error`] — the workspace error type, context combinators, and the
19//!   `client_*` / `internal_*` / `api_*` bail macros. Always compiled.
20//! - [`prelude`] — the handful of names most call sites want in scope.
21//! - `concur_control` (feature `concur_control`) — semaphore-based backpressure
22//!   on in-flight rows and bytes.
23//! - `batching` (feature `batching`) — coalesces concurrent single-item calls
24//!   into batched runner invocations.
25//! - `fingerprint` (feature `fingerprint`) — a 128-bit structural hash of any
26//!   `Serialize` value, built on BLAKE3.
27//! - `retryable` (feature `retryable`) — retry-with-backoff around a fallible
28//!   async operation.
29//! - `bytes_decode` (feature `bytes_decode`) — decodes a byte buffer to text,
30//!   sniffing the BOM and falling back to UTF-8.
31
32#![cfg_attr(coverage_nightly, feature(coverage_attribute))]
33
34#[cfg(feature = "batching")]
35pub mod batching;
36#[cfg(feature = "bytes_decode")]
37pub mod bytes_decode;
38#[cfg(feature = "concur_control")]
39pub mod concur_control;
40pub mod error;
41#[cfg(feature = "fingerprint")]
42pub mod fingerprint;
43pub mod prelude;
44#[cfg(feature = "retryable")]
45pub mod retryable;