# Fluent Builder API — `fluent.rs`

The top-level `Str` builder is the primary ergonomic API, but `rok-utils` also provides collection-level fluency via `Collect<T>`:

```rust
pub struct Collect<T> {
    inner: Vec<T>,
}

impl<T: Clone + 'static> Collect<T> {
    pub fn of(arr: Vec<T>) -> Self
    pub fn map<U>(self, f: impl Fn(T) -> U) -> Collect<U>
    pub fn filter(self, f: impl Fn(&T) -> bool) -> Self
    pub fn take(self, n: usize) -> Self
    pub fn skip(self, n: usize) -> Self
    pub fn unique(self) -> Self  where T: PartialEq
    pub fn chunk(self, size: usize) -> Collect<Vec<T>>
    pub fn tap(self, f: impl FnOnce(&[T])) -> Self
    pub fn when(self, cond: bool, f: impl FnOnce(Self) -> Self) -> Self
    pub fn sort_by(self, cmp: impl Fn(&T, &T) -> std::cmp::Ordering) -> Self
    pub fn value(self) -> Vec<T>
    pub fn first(self) -> Option<T>
    pub fn last(self) -> Option<T>
    pub fn count(&self) -> usize
    pub fn is_empty(&self) -> bool
}
```

## Str::of() Quick Reference

```rust
use rok_utils::str::Str;

let result = Str::of("  Hello World  ")
    .trim()
    .to_snake_case()
    .slug()
    .truncate(20)
    .when_empty(|s| s.append("default"))
    .value();
// "hello-world"

let banner = Str::of("welcome to rok")
    .title()
    .wrap("=== ", " ===")
    .value();
// "=== Welcome To Rok ==="
```