Show HN: Rust macro utility for batching expensive async operations
9 days ago
- #batching
- #Rust
- #async
- Rust macro utility 'batched' for batching expensive async operations.
- Supports configuration options like 'limit', 'concurrent', and 'window' for batch processing.
- Target function must be async and take a single argument of type Vec<T>.
- Return values are either cloned or pulled from an iterator based on the function's return type.
- Requires tokio async runtime and does not work inside structs.
- Includes tracing spans for batched requests and OpenTelemetry support for linked spans.
- Example usage with PostgreSQL for inserting messages in batches.
- Error handling with SharedError for non-Clone error types.