Computes a stable hash of the per-call arguments that affect output. Used as the `args_hash` cache-key component so two calls with different `lines` or `limit` values map to distinct rows.
(args: &serde_json::Value)
| 39 | /// as the `args_hash` cache-key component so two calls with different `lines` |
| 40 | /// or `limit` values map to distinct rows. |
| 41 | pub fn args_hash(args: &serde_json::Value) -> String { |
| 42 | let canonical = canonicalize(args); |
| 43 | let mut hasher = Sha256::new(); |
| 44 | hasher.update(canonical.as_bytes()); |
| 45 | hex::encode(hasher.finalize()) |
| 46 | } |
| 47 | |
| 48 | /// Sorts JSON object keys recursively so two semantically-equal arg objects |
| 49 | /// hash identically regardless of key insertion order. |
no test coverage detected