Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

rok-utils

A Laravel/AdonisJS-inspired utility crate for Rust with zero-bloat, ergonomic helpers.

crates.io docs.rs License: MIT

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?

FeatureDescription
Battle-tested APIsInspired by Laravel’s Str and AdonisJS’s string helpers
ErgonomicFluent Str::of() builder for chainable transformations
Error-firstAdonisJS-style typed error codes with HTTP status
Zero-bloatFeature flags ensure consumers pay only for what they use
UTF-8 nativeAll string operations use chars(), never raw bytes

Next Steps