Chapter 11 — Async / IO / extensions
7 tests on the most-used extension surfaces. No DB / network needed.
Run with cargo test --test cookbook_chapter11_extensions.
$ cargo test --test cookbook_chapter11_extensions
test result: ok. 7 passed; 0 failed; 0 ignored
- §11.135
cache::get_or_set(&dyn Cache, key, factory, ttl)— loader runs once; subsequent reads hit the cached value. →cache_get_or_set_memoizes_loader,cache_set_get_json_round_trips - §11.128
webhook::sign(format, secret, body)+verify_signature(...)round-trip.HexSha256produces a raw hex digest;HexSha256WithPrefixproduces GitHub'ssha256=<hex>shape;Base64Sha256for Stripe-style headers. →webhook_sign_then_verify_round_trip,webhook_github_prefix_format - §11.92
signed_url::sign[_at](url, secret, ttl|None)+verify[_at](signed, secret[, now_secs])for one-time / time-bounded URLs. →signed_url_sign_then_verify_at_respects_expiry,signed_url_no_expiry_always_verifies - §11.126
Scheduler::new().every(name, period, job).start()runs jobs at the given period;Handle::shutdown()stops further fires. →scheduler_every_fires_periodic_job
Also available in the framework (no dedicated cookbook recipe yet,
but each has live tests under rustango/tests): the WebSocket hub and
SSE, the background jobs queue, the retrying HTTP client, email
backends, filesystem + S3 storage, media uploads, notifications,
signals (wiring receivers to model save/delete events), compression
middleware, and CSP-nonce injection.