Expand description
§Lodash-RS: High-Performance Rust Collection Library
A type-safe, high-performance Rust implementation of Lodash collection methods with zero-cost abstractions.
§Features
- 100% API Compatible: Complete compatibility with Lodash collection methods
- Type Safe: Leverages Rust’s type system for compile-time safety
- Zero-Cost Abstractions: No runtime overhead compared to hand-written code
- Chainable: Support for fluent method chaining
- Async Support: Built-in async/await support for all operations
- Parallel Processing: Automatic parallelization for large collections
- Memory Safe: Guaranteed memory safety with no data races
- WASM Compatible: Full WebAssembly support for browser usage
§Quick Start
use rust_lodash::prelude::*;
// Basic usage
let doubled = map(&[1, 2, 3, 4], |x| x * 2);
assert_eq!(doubled, vec![2, 4, 6, 8]);
// Chainable operations
let result = chain(&[1, 2, 3, 4, 5])
.filter(|x| x % 2 == 0)
.map(|x| x * 3)
.collect();
assert_eq!(result, vec![6, 12]);
// Async operations (requires async feature)
// let async_result = map_async(&[1, 2, 3], |x| async move { x * 2 }).await;
// assert_eq!(async_result, vec![2, 4, 6]);§Architecture
The library is organized into several modules:
collection: Core collection methods (iteration, query, transform, operations)chain: Fluent method chaining systemutils: Utility functions and type conversionsextensions: Advanced features (parallel processing, WASM support)
§Performance
Lodash-RS is designed for maximum performance:
- SIMD Optimizations: Automatic vectorization for numeric operations
- Parallel Processing: Multi-threaded execution for large datasets
- Zero-Copy Operations: Minimal memory allocation and copying
- Cache-Friendly: Optimized memory layout for better cache performance
§Safety
- Memory Safe: No buffer overflows, use-after-free, or data races
- Type Safe: Compile-time type checking prevents runtime errors
- Panic-Free: All operations handle edge cases gracefully
- Error Handling: Comprehensive error types with proper propagation
Modules§
- chain
- Chain module for Lodash-RS.
- collection
- Collection module for Lodash-RS.
- extensions
- Extensions module for Lodash-RS.
- prelude
- Prelude module containing the most commonly used items.
- utils
- Utility modules for Lodash-RS.
Macros§
- lodash_
error - Macro for creating custom errors with context.
- lodash_
try - Macro for early return on error with context.
Constants§
- HAS_
ASYNC - Whether async features are enabled.
- HAS_
PARALLEL - Whether parallel processing features are enabled.
- HAS_
WASM - Whether WebAssembly features are enabled.
- VERSION
- The version of the rust-lodash crate.