Expand description
Run a tiny probe binary that includes the user’s whisker.rs and
emits the resulting Config as JSON on stdout.
§Why a probe binary?
whisker.rs is regular Rust source — there’s no parser we could
point at the file. The user’s configure function can do
arbitrary computation (env lookups, conditional fields, etc.), so
the only way to know what it means is to execute it.
The probe is a one-file cargo run that:
include!("path/to/whisker.rs")— splices the user’sconfigurefn into our tinymain.- Calls
configure(&mut Config::default()). - Serializes the populated config to JSON and prints it.
Compile cost is single-digit seconds the first time (just
whisker-config + serde_json), and the result is cached
under target/.whisker/config-cache.json. The cache is
invalidated by mtime: re-running the probe is a no-op unless
whisker.rs was touched since the cache write.
§Why not include the umbrella whisker crate?
whisker-config is intentionally a small, dependency-light
crate so the probe build is cheap. Pulling in whisker
(umbrella) would also pull whisker-runtime, whisker-driver,
Lynx headers, etc. — turning the probe into a multi-minute build.
The user crate’s whisker.rs therefore writes
use whisker_config::Config directly, not use whisker::Config.
Functions§
- run
- Run the probe and return the parsed config. Caches via mtime so
the second call (and later) returns instantly until
whisker.rschanges.