rok-utils
A Laravel/AdonisJS-inspired utility crate for Rust with zero-bloat, ergonomic helpers.
Features
- String utilities — case conversion, truncation, pluralization, fluent builder
- Array utilities — map, filter, reduce, chunk, unique, group_by
- Error handling — AdonisJS-style error codes with HTTP status
- Functional patterns — pipe, compose, tap, retry, lazy, memoize
- Data utilities — numbers, dates, hashing, IDs
- Type guards — JSON type guards and dot-path access
Quick Example
#![allow(unused)]
fn main() {
use rok_utils::{to_snake_case, Str};
let snake = to_snake_case("HelloWorld");
assert_eq!(snake, "hello_world");
let result = Str::of(" hello world ")
.trim()
.lower()
.replace(" ", "_")
.value();
assert_eq!(result, "hello_world");
}
Why rok-utils?
| Feature | Description |
|---|---|
| Battle-tested APIs | Inspired by Laravel’s Str and AdonisJS’s string helpers |
| Ergonomic | Fluent Str::of() builder for chainable transformations |
| Error-first | AdonisJS-style typed error codes with HTTP status |
| Zero-bloat | Feature flags ensure consumers pay only for what they use |
| UTF-8 native | All string operations use chars(), never raw bytes |
Next Steps
- Installation — Add to your project
- Getting Started — Quick tutorial
- String Utilities — Explore string functions