Skip to main content

Crate helpers4

Crate helpers4 

Source
Expand description

General-purpose helpers, one module per category.

Module and function names may overlap across modules (array::compact and object::compact are different functions); import through the module path, e.g. helpers4::string::capitalize.

Modules§

animation
Animation timing without a framework: Easing curves (the CSS keywords, cubic-bezier(), steps() and linear(), read from a CSS string or built directly), physical Springs with their settling time, and to_css_linear to turn any curve into a CSS linear().
ansi
ANSI escape sequences: remove them from captured output and build styled text.
array
Helpers for slices and Vecs that the standard library does not provide.
bytes
Helpers for byte slices and sizes that the standard library does not provide.
cache
Caches and stores: entries that expire with a passed-in clock (ExpiringMap), and a capacity-bounded map that evicts by recency instead (LruCache). Neither ever reads a clock or the system allocator’s notion of “recent” behind the caller’s back.
ci
Detecting CI environments and reporting pipeline status.
color
Colors without a dependency: parsing, hex, CSS output, HSL, alpha, blending and WCAG contrast.
commit
Conventional Commits: parse a message, decide the version bump, validate.
date
Calendar dates without time zones: validation, ISO 8601 text, weekdays and day arithmetic.
duration
Parsing and formatting of durations as short human-readable strings (1h30m).
env
Dotenv (.env) helpers working on plain text: no file or process-environment access, so they are deterministic and easy to test. Read the file yourself, edit the content here, and write it back.
fs
File-system helpers: safe writes, missing-file-as-None, listing and path checks.
function
Helpers around functions: composition, memoization, retrying and rate limiting.
future
Runtime-neutral helpers for Futures, built on the standard library only.
geometry
2D geometry in f64: Point, Rect and the affine Matrix, in the layout of CSS and SVG matrix(a b c d e f).
hex
Byte/text encodings with typed errors: hexadecimal, and base64/base32 (RFC 4648).
http
HTTP header value helpers on plain text: no dependency on an HTTP crate.
id
Unique identifiers without the uuid or ulid crates: Uuid (v4 random, v7 sortable by time), Ulid, and short URL-safe ids over an Alphabet.
iter
Helpers for any Iterator, not only slices: work on a lazy, single-use or unbounded source.
license
SPDX license identifiers and expressions: look a license up, parse MIT OR Apache-2.0, check it against a policy, write a source header.
map
Helpers for HashMap that the standard library does not provide.
markdown
Helpers for writing Markdown safely: escaping, links, code, quotes, tables and heading anchors.
net
Network helpers on std::net and plain text: no I/O, no resolution.
number
Numeric helpers that the standard library does not provide.
random
Randomness without a hidden global generator.
secret
Keeping secrets out of logs: a wrapper that never prints its value, redaction, masking and credential detection.
set
Helpers for HashSet that the standard library does not provide.
string
String manipulation and formatting helpers.
time
Time helpers. Reading the clock is explicit and fallible: a clock set before 1970 is an error, not 0.
url
URLs without a dependency: percent-encoding, query strings, a parser and reference resolution.
validate
Shape checks for common user-facing formats: pragmatic subsets that catch real mistakes, not full grammars. None of them normalizes or parses the value, only checks it.
version
Semantic Versioning 2.0.0: parsing, precedence, bumps and Cargo-style requirements.