Files
ez-urandom/IDEAS.md
T
ddidderr 631dc1938c docs: update ergonomics backlog
Refresh IDEAS.md after the ergonomic API pass so the backlog no longer lists
implemented items as open work. Split the remaining ideas into deferred and
still-open groups to record which omissions were deliberate crate-scope choices.

This keeps the project notes aligned with the public API and captures the
reasoning for not adding globals, shuffle, or password presets yet.

Test Plan:
- Not run; documentation-only change.

Refs: IDEAS.md ergonomics backlog
2026-04-28 20:10:06 +02:00

28 lines
1.2 KiB
Markdown

# Ergonomy ideas
- Implemented:
- `Default` for infallible convenience construction.
- `fill_bytes(&mut [u8])` convenience so callers don't need to import
`io::Read`.
- `gen_range_<int>` for all primitive integer widths.
- `gen_range_<int>_in` for standard `RangeBounds` forms, including `Range`
and `RangeInclusive`.
- `choose<T>(&[T]) -> &T` for generic slice selection.
- `Clone` plus fallible `try_clone()` so multiple call sites can own separate
handles without adding interior mutability.
- Presets for direct alphabet names: `OsRandom::token(len)`, `::hex(len)`,
and `::pin(len)`.
- Deferred to keep the crate small:
- `thread_local` global helpers like `ez_urandom::random_u64()` without
constructing or threading an `OsRandom`.
- `shuffle(&mut [T])`; `choose` covers the smaller selection use case without
growing into collection algorithms.
- `OsRandom::password(len)`; password generation needs policy decisions about
symbols, ambiguous characters, and service-specific constraints.
- Still open for later consideration:
- `bool()` / `f64()` (unit interval) helpers.
- Accept a `&str` alphabet directly (not just `&[u8]`) and drop the ASCII
assert by iterating `chars()`.